diff --git a/src/modules/actions/apiUpdaters/messages.ts b/src/modules/actions/apiUpdaters/messages.ts index 2b602f0a5..322423161 100644 --- a/src/modules/actions/apiUpdaters/messages.ts +++ b/src/modules/actions/apiUpdaters/messages.ts @@ -485,7 +485,7 @@ addReducer('apiUpdate', (global, actions, update: ApiUpdate) => { const chat = selectChat(global, update.chatId); const currentReactions = message?.reactions; - // `updateMessageReactions` happens with an interval so we try to avoid redundant global state updates + // `updateMessageReactions` happens with an interval, so we try to avoid redundant global state updates if (currentReactions && areDeepEqual(reactions, currentReactions)) { return; } @@ -501,6 +501,7 @@ addReducer('apiUpdate', (global, actions, update: ApiUpdate) => { notifyAboutMessage({ chat, message: newMessage, + isReaction: true, }); } diff --git a/src/util/notifications.ts b/src/util/notifications.ts index 58571c3c8..df98c1dc5 100644 --- a/src/util/notifications.ts +++ b/src/util/notifications.ts @@ -332,12 +332,15 @@ async function getAvatar(chat: ApiChat) { export async function notifyAboutMessage({ chat, message, -}: { chat: ApiChat; message: Partial }) { + isReaction = false, +}: { chat: ApiChat; message: Partial; isReaction?: boolean }) { const { hasWebNotifications } = await loadNotificationSettings(); if (!checkIfShouldNotify(chat)) return; const areNotificationsSupported = checkIfNotificationsSupported(); if (!hasWebNotifications || !areNotificationsSupported) { - // only play sound if web notifications are disabled + // Do not play notification sound for reactions if web notifications are disabled + if (isReaction) return; + // Only play sound if web notifications are disabled playNotifySoundDebounced(String(message.id) || chat.id); return; } @@ -364,7 +367,7 @@ export async function notifyAboutMessage({ icon, chatId: chat.id, messageId: message.id, - reaction: activeReaction ? activeReaction.reaction : undefined, + reaction: activeReaction?.reaction, }, }); }