From c183315d52bf52d7a8d39ab5ed7e90f46808f87f Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Fri, 16 Sep 2022 08:15:16 -0600 Subject: [PATCH] Don't notify of updated close time when resolving market --- functions/src/create-notification.ts | 5 +++-- functions/src/on-update-contract.ts | 4 ++++ web/components/notification-settings.tsx | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/functions/src/create-notification.ts b/functions/src/create-notification.ts index ebd3f26c..9f84b1aa 100644 --- a/functions/src/create-notification.ts +++ b/functions/src/create-notification.ts @@ -416,8 +416,9 @@ export const createCommentOrAnswerOrUpdatedContractNotification = async ( ) } - //TODO: store all possible reasons why the user might be getting the notification and choose the most lenient that they - // have enabled so they will unsubscribe from the least important notifications + //TODO: store all possible reasons why the user might be getting the notification + // and choose the most lenient that they have enabled so they will unsubscribe + // from the least important notifications await notifyRepliedUser() await notifyTaggedUsers() await notifyContractCreator() diff --git a/functions/src/on-update-contract.ts b/functions/src/on-update-contract.ts index 2972a305..5e2a94c0 100644 --- a/functions/src/on-update-contract.ts +++ b/functions/src/on-update-contract.ts @@ -13,6 +13,10 @@ export const onUpdateContract = functions.firestore if (!contractUpdater) throw new Error('Could not find contract updater') const previousValue = change.before.data() as Contract + + // Resolution is handled in resolve-market.ts + if (!previousValue.isResolved && contract.isResolved) return + if ( previousValue.closeTime !== contract.closeTime || previousValue.question !== contract.question diff --git a/web/components/notification-settings.tsx b/web/components/notification-settings.tsx index b806dfb2..7c1f3546 100644 --- a/web/components/notification-settings.tsx +++ b/web/components/notification-settings.tsx @@ -63,7 +63,6 @@ export function NotificationSettings(props: { 'contract_from_followed_user', 'unique_bettors_on_your_contract', // TODO: add these - // one-click unsubscribe only unsubscribes them from that type only, (well highlighted), then a link to manage the rest of their notifications // 'profit_loss_updates', - changes in markets you have shares in // biggest winner, here are the rest of your markets