From a23e951b097a7bf271a7c3bed6602157b17e42e5 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Sat, 20 Nov 2021 12:18:00 +0300 Subject: [PATCH] Notifications: Fix missing sound when notifications are not permitted (#1555) --- src/util/notifications.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/notifications.ts b/src/util/notifications.ts index cd7131ec..8388286f 100644 --- a/src/util/notifications.ts +++ b/src/util/notifications.ts @@ -322,12 +322,13 @@ export async function notifyAboutNewMessage({ }: { chat: ApiChat; message: Partial }) { const { hasWebNotifications } = await loadNotificationSettings(); if (!checkIfShouldNotify(chat)) return; - if (!hasWebNotifications) { + const areNotificationsSupported = checkIfNotificationsSupported(); + if (!hasWebNotifications || !areNotificationsSupported) { // only play sound if web notifications are disabled playNotifySoundDebounced(String(message.id) || chat.id); return; } - if (!checkIfNotificationsSupported()) return; + if (!areNotificationsSupported) return; if (!message.id) return; const {