Skip to content
Snippets Groups Projects
Commit 78693563 authored by Rodrigo Orem's avatar Rodrigo Orem Committed by Rodrigo Nascimento
Browse files

Fix multiple notifications (closes #3517) (#4074)

* Fix multiple notifications (resolve #3517) and close after click

* Fix replacing notification for different messages from the same room
parent ab9371e5
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,7 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
}
/**
* Chechs if a messages contains a user highlight
* Checks if a message contains a user highlight
*
* @param {string} message
* @param {array|undefined} highlights
......@@ -127,6 +127,7 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
text: message.msg,
duration: settings.desktopNotificationDurations[userOfMention._id],
payload: {
_id: message._id,
rid: message.rid,
sender: message.u,
type: room.t,
......@@ -281,6 +282,7 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
text: message.msg,
duration: settings.desktopNotificationDurations[usersOfMentionId],
payload: {
_id: message._id,
rid: message.rid,
sender: message.u,
type: room.t,
......
......@@ -17,6 +17,7 @@
n = new Notification notification.title,
icon: notification.icon or getAvatarUrlFromUsername notification.payload.sender.username
body: _.stripTags(message.msg)
tag: notification.payload._id,
silent: true
notificationDuration = (notification.duration - 0) or (Meteor.user()?.settings?.preferences?.desktopNotificationDuration - 0) or RocketChat.settings.get('Desktop_Notifications_Duration')
......@@ -25,6 +26,7 @@
if notification.payload?.rid?
n.onclick = ->
this.close()
window.focus()
switch notification.payload.type
when 'd'
......
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