From f46575add2ca19c85d1ef12d8854238c1343dcad Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 26 Aug 2026 18:05:15 +0300 Subject: [PATCH] better fix --- src/services/chat_utils/chat_utils.js | 3 --- src/stores/chats.js | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/services/chat_utils/chat_utils.js b/src/services/chat_utils/chat_utils.js index 643f7f59e..bbe74ce09 100644 --- a/src/services/chat_utils/chat_utils.js +++ b/src/services/chat_utils/chat_utils.js @@ -5,8 +5,6 @@ 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) @@ -24,7 +22,6 @@ export const maybeShowChatNotification = (chat) => { opts.image = chat.lastMessage.attachment.preview_url } - chat.lastNotifiedMessageId = chat.lastMessage.id showDesktopNotification(opts) } diff --git a/src/stores/chats.js b/src/stores/chats.js index 1cf4f4a3d..b30c1c42c 100644 --- a/src/stores/chats.js +++ b/src/stores/chats.js @@ -79,13 +79,15 @@ export const useChatsStore = defineStore('chats', { updateChat(updatedChat) { const chat = this.data.get(updatedChat.id) if (chat) { + const isNewMessage = chat.lastMessage !== updatedChat.lastMessage chat.lastMessage = updatedChat.lastMessage chat.unread = updatedChat.unread chat.updated_at = updatedChat.updated_at + if (!isNewMessage) return } else { this.data.set(updatedChat.id, updatedChat) } - maybeShowChatNotification(chat ?? updatedChat) + maybeShowChatNotification(chat) }, deleteChat(id) { this.data.delete(id)