Skip to content

Commit

Permalink
added count, total, and offset fields in response object
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosSpessatto committed Mar 26, 2018
1 parent 1097e87 commit 49c300c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/rocketchat-api/server/v1/channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -833,8 +833,16 @@ RocketChat.API.v1.addRoute('channels.getAllUserMentionsByChannel', { authRequire
}
}));

const allMentions = Meteor.runAsUser(this.userId, () => Meteor.call('getUserMentionsByChannel', {
roomId,
options: {}
}));

return RocketChat.API.v1.success({
mentions
mentions,
count: mentions.length,
offset,
total: allMentions.length
});
}
});
Expand Down
3 changes: 3 additions & 0 deletions tests/end-to-end/api/02-channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,9 @@ describe('[Channels]', function() {
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('mentions').and.to.be.an('array');
expect(res.body).to.have.property('count');
expect(res.body).to.have.property('offset');
expect(res.body).to.have.property('total');
})
.end(done);
});
Expand Down

0 comments on commit 49c300c

Please sign in to comment.