diff --git a/functions/src/on-update-contract.ts b/functions/src/on-update-contract.ts index 2042f726..28523eae 100644 --- a/functions/src/on-update-contract.ts +++ b/functions/src/on-update-contract.ts @@ -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(