Skip to content

Conversation

@MarcosSpessatto
Copy link
Contributor

Copy link
Member

@engelgabriel engelgabriel left a 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.

@engelgabriel engelgabriel modified the milestones: 1.0.0, 1.1.0 Apr 6, 2019
@rodrigok rodrigok modified the milestones: 1.1.0, 1.2.0 May 15, 2019
@engelgabriel engelgabriel modified the milestones: 1.2.0, 1.3.0 Jul 10, 2019
@sampaiodiego sampaiodiego modified the milestones: 1.3.0, 1.4.0 Jul 25, 2019
@sampaiodiego sampaiodiego modified the milestones: 2.0.0, 2.1.0 Sep 6, 2019
@engelgabriel engelgabriel modified the milestones: 2.1.0, 2.2.0 Oct 13, 2019
@rodrigok rodrigok modified the milestones: 2.2.0, 2.3.0 Oct 24, 2019
@Maqsyo
Copy link

Maqsyo commented Jan 20, 2020

So there's no progress on this, mh? :(

@Kakoum
Copy link

Kakoum commented Feb 11, 2020

Anyone have news?
Is there no way today to retrieve a user's list of unread messages?

:(

@engelgabriel engelgabriel modified the milestones: 2.3.0, 3.1.0 Mar 17, 2020
@engelgabriel engelgabriel modified the milestones: 3.1.0, 3.2.0 Apr 20, 2020
from: 'rocketchat_message',
localField: 'rid',
foreignField: 'rid',
as: 'unreads',
Copy link
Member

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

Copy link
Member

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

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, {
Copy link
Member

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.

@MarcosSpessatto MarcosSpessatto modified the milestones: 3.2.0, 3.3.0 May 4, 2020
@rodrigok rodrigok modified the milestones: 3.3.0, 3.4.0 May 21, 2020
@rodrigok rodrigok modified the milestones: 3.4.0, 3.5.0 Jun 20, 2020
Marcos Defendi added 2 commits June 30, 2020 10:24
Conflicts:
	app/models/server/models/Subscriptions.js
Get unread property directly from subscriptions
@Boby
Copy link

Boby commented Aug 20, 2020

jumping on this, is there any api on this?

@WithAlex
Copy link

any news ?

@alba-simedia
Copy link

If api is not available, it would be a solution use notifications?

@tassoevan
Copy link
Contributor

Replaced by #20905.

@tassoevan tassoevan closed this Jul 27, 2021
@tassoevan tassoevan deleted the rest-add-unreads-user-info branch July 27, 2021 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.