Skip to content
Snippets Groups Projects
Commit b1ff027f authored by Gabriel Engel's avatar Gabriel Engel Committed by GitHub
Browse files

Merge pull request #3966 from RocketChat/hotfix/selfmade-notifications

Prevent selfmade notifications
parents 56fc9792 d6103219
No related branches found
No related tags found
No related merge requests found
...@@ -43,13 +43,17 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) { ...@@ -43,13 +43,17 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
if (!toAll && mention._id === 'all') { if (!toAll && mention._id === 'all') {
toAll = true; toAll = true;
} }
mentionIds.push(mention._id); if (mention._id !== message.u._id) {
mentionIds.push(mention._id);
}
}); });
} }
highlights.forEach(function(user) { highlights.forEach(function(user) {
if (user && user.settings && user.settings.preferences && messageContainsHighlight(message, user.settings.preferences.highlights)) { if (user && user.settings && user.settings.preferences && messageContainsHighlight(message, user.settings.preferences.highlights)) {
highlightsIds.push(user._id); if (user._id !== message.u._id) {
highlightsIds.push(user._id);
}
} }
}); });
......
...@@ -266,8 +266,8 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) { ...@@ -266,8 +266,8 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
userIdsToPushNotify = userIdsToPushNotify.concat(highlightsIds); userIdsToPushNotify = userIdsToPushNotify.concat(highlightsIds);
} }
userIdsToNotify = _.compact(_.unique(userIdsToNotify)); userIdsToNotify = _.without(_.compact(_.unique(userIdsToNotify)), message.u._id);
userIdsToPushNotify = _.compact(_.unique(userIdsToPushNotify)); userIdsToPushNotify = _.without(_.compact(_.unique(userIdsToPushNotify)), message.u._id);
if (userIdsToNotify.length > 0) { if (userIdsToNotify.length > 0) {
for (j = 0, len1 = userIdsToNotify.length; j < len1; j++) { for (j = 0, len1 = userIdsToNotify.length; j < len1; j++) {
......
{ {
"dependencies": { "dependencies": {
"he": {
"version": "1.1.0"
},
"iconv-lite": { "iconv-lite": {
"version": "0.4.13" "version": "0.4.13"
}, },
......
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