-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Add unreads property to rooms in user.info endpoint #13634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
engelgabriel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extra info is expensive to get, so we need to provide it only is requested/needed. So we should have an extra parameter for that.
Also, we need to leverage the DB to do that, using an aggregation query rather than iterating the results on the application layer.
…t unread messages
|
So there's no progress on this, mh? :( |
|
Anyone have news? :( |
| from: 'rocketchat_message', | ||
| localField: 'rid', | ||
| foreignField: 'rid', | ||
| as: 'unreads', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use pipeline here to filter and get only the unread messages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use pipeline on room lookup as well to get only the lm field
app/api/server/v1/users.js
Outdated
| const myself = user._id === this.userId; | ||
| if (fields.userRooms === 1 && (myself || hasPermission(this.userId, 'view-other-user-channels'))) { | ||
| user.rooms = Subscriptions.findByUserId(user._id, { | ||
| user.rooms = Promise.await(Subscriptions.findByUserIdWithUnreadMessagesCount(user._id, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a param to decide whenever check for the unreads as well.
Conflicts: app/models/server/models/Subscriptions.js
Get unread property directly from subscriptions
|
jumping on this, is there any api on this? |
|
any news ? |
|
If api is not available, it would be a solution use notifications? |
|
Replaced by #20905. |
Related to the forum post: https://forums.rocket.chat/t/api-user-info-unread-messages-and-count-of/1152