[NEW] Add option to user show hidden rooms when unread messages#8053
[NEW] Add option to user show hidden rooms when unread messages#8053lindoelio wants to merge 10 commits intoRocketChat:developfrom lindoelio:increment-for-rooms-visibility-control
Conversation
| // the unread counter, as it is only for mentions and direct messages | ||
| RocketChat.models.Subscriptions.setAlertForRoomIdExcludingUserId(message.rid, message.u._id); | ||
| const subscriptions = RocketChat.models.Subscriptions.findByRoomIdForAlert(message.rid); | ||
| if (subscriptions) { |
There was a problem hiding this comment.
subscriptions will be the cursor, so it will always exists
| let userSubscribed = {}; | ||
| let showHiddenRoom; | ||
| subscriptions.forEach(function(subscription) { | ||
| if (subscription.u._id !== message.u._id) { |
There was a problem hiding this comment.
If you don't want to process the sender, you could pass that to query and not retrieve the record
| let showHiddenRoom; | ||
| subscriptions.forEach(function(subscription) { | ||
| if (subscription.u._id !== message.u._id) { | ||
| userSubscribed = RocketChat.models.Users.findById(message.u._id); |
There was a problem hiding this comment.
Is that correct? Get the message user and not the subscription user?
There was a problem hiding this comment.
findById is a find, so it returns a cursor, not one record, did you tested this?
| if (subscription.u._id !== message.u._id) { | ||
| userSubscribed = RocketChat.models.Users.findById(message.u._id); | ||
| showHiddenRoom = userSubscribed && userSubscribed.settings && userSubscribed.settings.preferences && userSubscribed.settings.preferences.showHiddenRoomsWhenUnreadMessages; | ||
| RocketChat.models.Subscriptions.setAlertForUserSubscribed(subscription.u._id, showHiddenRoom); |
There was a problem hiding this comment.
The idea here is to set everyone to alert at line 109 and then set again here to alert true/false depending on each user preference?
There was a problem hiding this comment.
What happens when showHiddenRoom is undefined?
There was a problem hiding this comment.
The idea is to set everyone to alert, but open room only for one want this behavior. Fixed.
| } | ||
|
|
||
| // Used to order subscriptions by activity | ||
| RocketChat.models.Subscriptions.updateUserSubscription(message.rid, message.u._id); |
…nto increment-for-rooms-visibility-control
|
I'll be closing this because the option to keep the rooms hidden will not be merged. |
@RocketChat/core
Closes #6299
Extend implements of PR #6299 for hit the suggestions about user's control over "show hidden rooms when unread messages".