Skip to content

Commit

Permalink
Merge pull request #4800 from RocketChat/show-notification-on-embedde…
Browse files Browse the repository at this point in the history
…d-mode-only-for-opened-room

Show a desktop notification only for the opened room if on embedded mode
  • Loading branch information
engelgabriel committed Oct 31, 2016
2 parents 6d9adf5 + 942d880 commit 048a017
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions client/notifications/notification.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
# group messages in which the user is mentioned.

Meteor.startup ->

Tracker.autorun ->

if Meteor.userId()

RocketChat.Notifications.onUser 'notification', (notification) ->

openedRoomId = undefined
Expand All @@ -23,9 +20,12 @@ Meteor.startup ->
fromOpenedRoom: messageIsInOpenedRoom
hasFocus: hasFocus

if !(hasFocus and messageIsInOpenedRoom)
# Play a sound.
if RocketChat.Layout.isEmbedded()
if !hasFocus and messageIsInOpenedRoom
# Play a sound and show a notification.
KonchatNotification.newMessage()
KonchatNotification.showDesktop notification
else if !(hasFocus and messageIsInOpenedRoom)
# Play a sound and show a notification.
KonchatNotification.newMessage()

# Show a notification.
KonchatNotification.showDesktop notification

0 comments on commit 048a017

Please sign in to comment.