summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2016-12-12 06:30:37 +0100
committerCorey Hulen <corey@hulen.com>2016-12-11 21:30:37 -0800
commitf0d71d87899967335210b9130a7e2b8d180bef46 (patch)
treed2941b8870e87677a84821dd32454a28594c889b /webapp
parentb5fcfd608c0e9ef764cace7328653e4d4c47a061 (diff)
downloadchat-f0d71d87899967335210b9130a7e2b8d180bef46.tar.gz
chat-f0d71d87899967335210b9130a7e2b8d180bef46.tar.bz2
chat-f0d71d87899967335210b9130a7e2b8d180bef46.zip
Add API call to get a channel by its name (#4700)
* add api for getByChannelName * add tests * fix test * rename and tests * check for permissions and test
Diffstat (limited to 'webapp')
-rw-r--r--webapp/client/client.jsx9
-rw-r--r--webapp/tests/client_channel.test.jsx15
2 files changed, 24 insertions, 0 deletions
diff --git a/webapp/client/client.jsx b/webapp/client/client.jsx
index 398ce4f83..88f910d46 100644
--- a/webapp/client/client.jsx
+++ b/webapp/client/client.jsx
@@ -1441,6 +1441,15 @@ export default class Client {
end(this.handleResponse.bind(this, 'getMyChannelMembers', success, error));
}
+ getChannelByName(channelName, success, error) {
+ request.
+ get(`${this.getChannelsRoute()}/name/${channelName}`).
+ set(this.defaultHeaders).
+ type('application/json').
+ accept('application/json').
+ end(this.handleResponse.bind(this, 'getChannelByName', success, error));
+ }
+
getChannelStats(channelId, success, error) {
request.
get(`${this.getChannelNeededRoute(channelId)}/stats`).
diff --git a/webapp/tests/client_channel.test.jsx b/webapp/tests/client_channel.test.jsx
index e8466021f..08c821f3c 100644
--- a/webapp/tests/client_channel.test.jsx
+++ b/webapp/tests/client_channel.test.jsx
@@ -426,5 +426,20 @@ describe('Client.Channels', function() {
);
});
});
+
+ it('getChannelByName', function(done) {
+ TestHelper.initBasic(() => {
+ TestHelper.basicClient().getChannelByName(
+ TestHelper.basicChannel().name,
+ function(data) {
+ assert.equal(data.name, TestHelper.basicChannel().name);
+ done();
+ },
+ function(err) {
+ done(new Error(err.message));
+ }
+ );
+ });
+ });
});