diff --git a/client/notifications/notification.js b/client/notifications/notification.js index 15cfa755f2de019f7fac8f42fb3323255332a3dc..a9045cdb2b1f4c867005f60ca43a436c141d7b4a 100644 --- a/client/notifications/notification.js +++ b/client/notifications/notification.js @@ -27,12 +27,12 @@ Meteor.startup(function() { if (RocketChat.Layout.isEmbedded()) { if (!hasFocus && messageIsInOpenedRoom) { // Play a sound and show a notification. - KonchatNotification.newMessage(); + KonchatNotification.newMessage(notification.payload.rid); KonchatNotification.showDesktop(notification); } } else if (!(hasFocus && messageIsInOpenedRoom)) { // Play a sound and show a notification. - KonchatNotification.newMessage(); + KonchatNotification.newMessage(notification.payload.rid); KonchatNotification.showDesktop(notification); } }); diff --git a/packages/rocketchat-ui/lib/notification.coffee b/packages/rocketchat-ui/lib/notification.coffee index 55f104d9f437b46fb555373f73bde01274d4ff40..308cf517ec99f3e9b051df477b49267385396097 100644 --- a/packages/rocketchat-ui/lib/notification.coffee +++ b/packages/rocketchat-ui/lib/notification.coffee @@ -47,10 +47,10 @@ notification.icon = avatarAsPng KonchatNotification.notify(notification) - newMessage: -> + newMessage: (rid) -> if not Session.equals('user_' + Meteor.userId() + '_status', 'busy') newMessageNotification = Meteor.user()?.settings?.preferences?.newMessageNotification || 'chime' - sub = ChatSubscription.findOne({ rid: Session.get('openedRoom') }, { fields: { audioNotification: 1 } }); + sub = ChatSubscription.findOne({ rid: rid }, { fields: { audioNotification: 1 } }); if sub?.audioNotification isnt 'none' if sub?.audioNotification $("audio##{sub.audioNotification}")[0].play()