fix email on mention

pull/7754/head
Martin Schoeler 9 years ago
parent 0cd4ca8c87
commit f527f4e7df
  1. 5
      packages/rocketchat-lib/server/lib/sendEmailOnMessage.js

@ -43,6 +43,9 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
if (room.t === 'd') {
usersToSendEmail[message.rid.replace(message.u._id, '')] = 'direct';
} else {
const isMentionAll = message.mentions.find((mention) => {
return mention._id === 'all';
});
RocketChat.models.Subscriptions.findWithSendEmailByRoomId(room._id).forEach((sub) => {
if (sub.disableNotifications) {
return delete usersToSendEmail[sub.u._id];
@ -55,7 +58,7 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
return mention._id === sub.u._id;
});
if (emailNotifications === 'mentions' || mentionedUser) {
if (emailNotifications === 'mentions' && (mentionedUser || isMentionAll)) {
return usersToSendEmail[sub.u._id] = 'mention';
}

Loading…
Cancel
Save