From da32a756a8cc5862de0e609ebc38b181f2ca2422 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Thu, 13 Oct 2022 08:41:33 -0600 Subject: [PATCH] Need not follow contract for tag notification --- functions/src/create-notification.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/functions/src/create-notification.ts b/functions/src/create-notification.ts index 204105ac..e04ddedc 100644 --- a/functions/src/create-notification.ts +++ b/functions/src/create-notification.ts @@ -197,6 +197,7 @@ export const createCommentOrAnswerOrUpdatedContractNotification = async ( return await notificationRef.set(removeUndefinedProps(notification)) } + const needNotFollowContractReasons = ['tagged_user'] const stillFollowingContract = (userId: string) => { return contractFollowersIds.includes(userId) } @@ -205,7 +206,12 @@ export const createCommentOrAnswerOrUpdatedContractNotification = async ( userId: string, reason: notification_reason_types ) => { - if (!stillFollowingContract(userId) || sourceUser.id == userId) return + if ( + (!stillFollowingContract(userId) && + !needNotFollowContractReasons.includes(reason)) || + sourceUser.id == userId + ) + return const privateUser = await getPrivateUser(userId) if (!privateUser) return const { sendToBrowser, sendToEmail } = getNotificationDestinationsForUser(