Skip to content
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

Merged
merged 7 commits into from
Mar 26, 2018

Conversation

MarcosSpessatto
Copy link
Member

Added endpoint to retrieve all the mentions of a channel. Requested in this issue.

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-10105 March 12, 2018 15:32 Inactive
@MarcosSpessatto
Copy link
Member Author

@rafaelks, could you take a look on this?

Copy link
Contributor

@rafaelks rafaelks left a 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?

@MarcosSpessatto
Copy link
Member Author

@rafaelks, exactly!

@rafaelks rafaelks added this to the 0.63.0 milestone Mar 13, 2018
@rafaelks
Copy link
Contributor

Added it to the milestone 👍


const user = RocketChat.models.Users.findOneById(Meteor.userId());

return RocketChat.models.Messages.findVisibleByMentionAndRoomId(user.username, roomId).fetch();
Copy link
Member

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

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?

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-10105 March 21, 2018 15:38 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-10105 March 21, 2018 17:41 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-10105 March 21, 2018 20:20 Inactive
}
}));

return RocketChat.API.v1.success({
Copy link
Member

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()
			});

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-10105 March 26, 2018 15:03 Inactive
@rodrigok rodrigok changed the title [NEW] added endpoint to retrieve all the mentions of a channel [NEW] Added endpoint to retrieve mentions of a channel Mar 26, 2018
@rodrigok rodrigok merged commit eee685f into develop Mar 26, 2018
@rodrigok rodrigok deleted the feature/rest-api-mentions-of-channel branch March 26, 2018 19:08
@rodrigok rodrigok mentioned this pull request Apr 4, 2018
@rafaelks
Copy link
Contributor

I just noticed that this API doesn't follow the way other APIs are working, with the prefix of channels, dm and groups. Do we want to change it, or keep it this way? Also, it's missing the docs. 👍

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.

4 participants