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 (
|
} else if (
|
||||||
previousValue.closeTime !== contract.closeTime ||
|
previousValue.closeTime !== contract.closeTime ||
|
||||||
previousValue.description !== contract.description
|
previousValue.question !== contract.question
|
||||||
) {
|
) {
|
||||||
let sourceText = ''
|
let sourceText = ''
|
||||||
if (previousValue.closeTime !== contract.closeTime && contract.closeTime)
|
if (
|
||||||
|
previousValue.closeTime !== contract.closeTime &&
|
||||||
|
contract.closeTime
|
||||||
|
) {
|
||||||
sourceText = contract.closeTime.toString()
|
sourceText = contract.closeTime.toString()
|
||||||
else {
|
} else if (previousValue.question !== contract.question) {
|
||||||
const oldTrimmedDescription = previousValue.description.trim()
|
sourceText = contract.question
|
||||||
const newTrimmedDescription = contract.description.trim()
|
|
||||||
if (oldTrimmedDescription === '') sourceText = newTrimmedDescription
|
|
||||||
else
|
|
||||||
sourceText = newTrimmedDescription
|
|
||||||
.split(oldTrimmedDescription)[1]
|
|
||||||
.trim()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await createNotification(
|
await createNotification(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user