From 48d9d79324d3546f65c2b2bba94ae1a593bd012d Mon Sep 17 00:00:00 2001 From: LomyW Date: Mon, 22 Jan 2024 15:14:36 +0100 Subject: [PATCH] do not send notification for system messages --- web/controllers/chatNotificationController/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/controllers/chatNotificationController/index.ts b/web/controllers/chatNotificationController/index.ts index b7ffa479f..4c8c125c7 100644 --- a/web/controllers/chatNotificationController/index.ts +++ b/web/controllers/chatNotificationController/index.ts @@ -39,8 +39,9 @@ async function handleChatNotification(req: WithRawBody, res: Response): const chatType = getChatType(conversationParticipants); const isUserVerified = await verifyChatUser(recipientUser); + const onlySystemMessages = data.messages.every((m) => m.type === 'SystemMessage'); - if (isUserVerified) { + if (!onlySystemMessages && isUserVerified) { const notificationContext = await getNotificationContext(notificationBody); const notificationAction = chatType === ChatType.ONE_ON_ONE ? 'missed_one_on_one_chat_message' : 'missed_course_chat_message';