From c034635c7842565023cf6790c3be99bf9dc10b09 Mon Sep 17 00:00:00 2001 From: Tom Richards Date: Tue, 9 Aug 2022 21:28:51 +0100 Subject: [PATCH] FIX ensure notifications are not sent back to the author of the message, unless they mention themselves --- notifications-lambda/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/notifications-lambda/src/index.ts b/notifications-lambda/src/index.ts index 33180667..3b577680 100644 --- a/notifications-lambda/src/index.ts +++ b/notifications-lambda/src/index.ts @@ -75,7 +75,8 @@ export const handler = async (event: DynamoDBStreamEvent) => { // TODO: Include more scenarios that trigger desktop notification (item) => isUserMentioned(item, user) || - doesUserManuallyHavePinboardOpen(item, user) + (item.userEmail !== user.email && // ensure we don't notify the person who sent the message + doesUserManuallyHavePinboardOpen(item, user)) ) .map((item) => webPush