Fix notification for updated questions (#782)
* Fix update notification for question, description * Don't notify on updated description
This commit is contained in:
parent
b9a667b126
commit
ec4d0f6b4a
|
@ -40,19 +40,16 @@ export const onUpdateContract = functions.firestore
|
|||
)
|
||||
} else if (
|
||||
previousValue.closeTime !== contract.closeTime ||
|
||||
previousValue.description !== contract.description
|
||||
previousValue.question !== contract.question
|
||||
) {
|
||||
let sourceText = ''
|
||||
if (previousValue.closeTime !== contract.closeTime && contract.closeTime)
|
||||
if (
|
||||
previousValue.closeTime !== contract.closeTime &&
|
||||
contract.closeTime
|
||||
) {
|
||||
sourceText = contract.closeTime.toString()
|
||||
else {
|
||||
const oldTrimmedDescription = previousValue.description.trim()
|
||||
const newTrimmedDescription = contract.description.trim()
|
||||
if (oldTrimmedDescription === '') sourceText = newTrimmedDescription
|
||||
else
|
||||
sourceText = newTrimmedDescription
|
||||
.split(oldTrimmedDescription)[1]
|
||||
.trim()
|
||||
} else if (previousValue.question !== contract.question) {
|
||||
sourceText = contract.question
|
||||
}
|
||||
|
||||
await createNotification(
|
||||
|
|
Loading…
Reference in New Issue
Block a user