Skip to content

Commit

Permalink
fix subscription-changed updating all messages(#14391)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored May 6, 2019
1 parent f36117b commit 5b312f3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/ui-utils/client/lib/RoomManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ callbacks.add('afterLogoutCleanUp', () => RoomManager.closeAllRooms(), callbacks

CachedCollectionManager.onLogin(() => {
Notifications.onUser('subscriptions-changed', (action, sub) => {
ChatMessage.update({ rid: sub.rid }, { $unset : { ignored : '' } }, { multi : true });
const ignored = sub && sub.ignored ? { $nin: sub.ignored } : { $exists: true };

ChatMessage.update({ rid: sub.rid, ignored }, { $unset: { ignored: true } }, { multi: true });
if (sub && sub.ignored) {
ChatMessage.update({ rid: sub.rid, t: { $ne: 'command' }, 'u._id': { $in : sub.ignored } }, { $set: { ignored : true } }, { multi : true });
}
Expand Down

0 comments on commit 5b312f3

Please sign in to comment.