From aa4089c91d3c982257e5ea98ed2f23cc734d9bc7 Mon Sep 17 00:00:00 2001 From: Ramon Souza Date: Thu, 6 May 2021 08:19:12 -0300 Subject: [PATCH] only play audio alert if there are new messages --- .../imports/ui/components/chat/alert/component.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx b/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx index 6094f65891..554c9bfb04 100755 --- a/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/chat/alert/component.jsx @@ -183,6 +183,7 @@ class ChatAlert extends PureComponent { idChatOpen, pushAlertDisabled, intl, + activeChats, } = this.props; const { @@ -192,7 +193,9 @@ class ChatAlert extends PureComponent { const notCurrentTabOrMinimized = document.hidden; const hasPendingNotifications = Object.keys(pendingNotificationsByChat).length > 0; - const shouldPlayChatAlert = notCurrentTabOrMinimized + const unreadMessages = activeChats.reduce((a, b) => a + b.unreadCounter, 0); + + const shouldPlayChatAlert = (notCurrentTabOrMinimized && unreadMessages > 0) || (hasPendingNotifications && !idChatOpen); return (