Skip to content
Snippets Groups Projects
Unverified Commit 155861b1 authored by Marcelo Schmidt's avatar Marcelo Schmidt
Browse files

Fix sound notification playing current opened room sound

parent 838b364f
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
});
......
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment