From a4b02936acb40396c3255c5dd366485d158faf59 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 26 Aug 2026 17:50:14 +0300 Subject: [PATCH] fix chat periodic notification --- src/services/chat_utils/chat_utils.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/services/chat_utils/chat_utils.js b/src/services/chat_utils/chat_utils.js index e99958110..643f7f59e 100644 --- a/src/services/chat_utils/chat_utils.js +++ b/src/services/chat_utils/chat_utils.js @@ -3,8 +3,13 @@ import { showDesktopNotification } from '../desktop_notification_utils/desktop_n import { useUsersStore } from 'src/stores/users.js' export const maybeShowChatNotification = (chat) => { + // No messages if (!chat.lastMessage) return + // Already shown notification for this message + if (chat.lastMessage.id === chat.lastNotifiedMessageId) return + // No unreads to display if (chat.unread === 0) return + // Don't notify on outgoing message (shouldn't happen with condition above) if (useUsersStore().currentUser.id === chat.lastMessage.account_id) return const opts = { @@ -19,6 +24,7 @@ export const maybeShowChatNotification = (chat) => { opts.image = chat.lastMessage.attachment.preview_url } + chat.lastNotifiedMessageId = chat.lastMessage.id showDesktopNotification(opts) }