From 233fff7eb5cd0a48965f9bd098b9ca15279864b2 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Sun, 28 May 2023 14:32:06 +0200 Subject: [PATCH] Notifications: Support mentions in muted groups (#3182) --- src/util/notifications.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/notifications.ts b/src/util/notifications.ts index 36c85fad2..8a6b2bd23 100644 --- a/src/util/notifications.ts +++ b/src/util/notifications.ts @@ -264,11 +264,11 @@ export async function subscribe() { } } -function checkIfShouldNotify(chat: ApiChat) { +function checkIfShouldNotify(chat: ApiChat, message: Partial) { if (!areSettingsLoaded) return false; const global = getGlobal(); const isMuted = selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global)); - if (isMuted || chat.isNotJoined || !chat.isListed) { + if ((isMuted && !message.isMentioned) || chat.isNotJoined || !chat.isListed) { return false; } // On touch devices show notifications when chat is not active @@ -420,7 +420,7 @@ export async function notifyAboutMessage({ isReaction = false, }: { chat: ApiChat; message: Partial; isReaction?: boolean }) { const { hasWebNotifications } = await loadNotificationSettings(); - if (!checkIfShouldNotify(chat)) return; + if (!checkIfShouldNotify(chat, message)) return; const areNotificationsSupported = checkIfNotificationsSupported(); if (!hasWebNotifications || !areNotificationsSupported) { if (!message.isSilent && !isReaction) {