Skip to content

Commit

Permalink
Merge pull request #9629 from RocketChat/feature/rest-api-custom-emoj…
Browse files Browse the repository at this point in the history
…i-list

[NEW] Add REST endpoint to get the list of custom emojis
  • Loading branch information
rodrigok authored Mar 27, 2018
2 parents b8da215 + 651a2b7 commit 19f0d93
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/rocketchat-api/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Package.onUse(function(api) {
api.addFiles('server/v1/subscriptions.js', 'server');
api.addFiles('server/v1/chat.js', 'server');
api.addFiles('server/v1/commands.js', 'server');
api.addFiles('server/v1/emoji-custom.js', 'server');
api.addFiles('server/v1/groups.js', 'server');
api.addFiles('server/v1/im.js', 'server');
api.addFiles('server/v1/integrations.js', 'server');
Expand Down
7 changes: 7 additions & 0 deletions packages/rocketchat-api/server/v1/emoji-custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
RocketChat.API.v1.addRoute('emoji-custom', { authRequired: true }, {
get() {
const emojis = Meteor.call('listEmojiCustom');

return RocketChat.API.v1.success({ emojis });
}
});
22 changes: 22 additions & 0 deletions tests/end-to-end/api/12-emoji-custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-env mocha */
/* globals expect */

import {getCredentials, api, request, credentials } from '../../data/api-data.js';

describe('[EmojiCustom]', function() {
this.retries(0);

before(done => getCredentials(done));

describe('GET', () => {
it('[/emoji-custom]', (done) => {
request.get(api('emoji-custom'))
.set(credentials)
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('emojis').and.to.be.a('array');
})
.end(done);
});
});
});

0 comments on commit 19f0d93

Please sign in to comment.