-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[NEW] Added endpoint to retrieve mentions of a channel #10105
Conversation
@rafaelks, could you take a look on this? |
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.
LGTM (haven't actually tested the code)!
@MarcosSpessatto The result is a list of messages, right?
@rafaelks, exactly! |
Added it to the milestone 👍 |
|
||
const user = RocketChat.models.Users.findOneById(Meteor.userId()); | ||
|
||
return RocketChat.models.Messages.findVisibleByMentionAndRoomId(user.username, roomId).fetch(); |
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 should be paginated
RocketChat.API.v1.addRoute('channels.getAllUserMentionsByChannel', { authRequired: true }, { | ||
get() { | ||
const mountMentionObject = (mention) => { | ||
return { |
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.
Why are you changing the message format?
…nnel' into feature/rest-api-mentions-of-channel
} | ||
})); | ||
|
||
return RocketChat.API.v1.success({ |
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.
@MarcosSpessatto the other paginated APIs returns more data like:
return RocketChat.API.v1.success({
channels: rooms,
count: rooms.length,
offset,
total: RocketChat.models.Rooms.find(ourQuery).count()
});
I just noticed that this API doesn't follow the way other APIs are working, with the prefix of |
Added endpoint to retrieve all the mentions of a channel. Requested in this issue.