Skip to content

Commit

Permalink
Fix notifications for direct messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed May 14, 2018
1 parent 1b8e8a5 commit 68cc13b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,13 @@ function sendAllNotifications(message, room) {
});
}

if (RocketChat.settings.get(`Accounts_Default_User_Preferences_${ notificationField }`) === 'all' && !disableAllMessageNotifications) {
const serverField = kind === 'email' ? 'emailNotificationMode' : `${ kind }Notifications`;
const serverPreference = RocketChat.settings.get(`Accounts_Default_User_Preferences_${ serverField }`);
if ((room.t === 'd' && serverPreference === 'mentions') || (serverPreference === 'all' && !disableAllMessageNotifications)) {
query.$or.push({
[notificationField]: { $exists: false }
});
} else if (RocketChat.settings.get(`Accounts_Default_User_Preferences_${ notificationField }`) === 'mentions' && mentionIdsWithoutGroups.length) {
} else if (serverPreference === 'mentions' && mentionIdsWithoutGroups.length) {
query.$or.push({
[notificationField]: { $exists: false },
'u._id': { $in: mentionIdsWithoutGroups }
Expand Down

0 comments on commit 68cc13b

Please sign in to comment.