From fa807d8e436e87b8c1749ea54c293a15c67f7f29 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 27 Apr 2016 16:02:58 -0400 Subject: Fixing permalinks to channels your not a memeber of (#2805) --- webapp/client/client.jsx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'webapp/client/client.jsx') diff --git a/webapp/client/client.jsx b/webapp/client/client.jsx index 98e660227..53a514082 100644 --- a/webapp/client/client.jsx +++ b/webapp/client/client.jsx @@ -71,6 +71,10 @@ export default class Client { return `${this.url}${this.urlVersion}/teams/${this.getTeamId()}/channels`; } + getChannelNameRoute(channelName) { + return `${this.url}${this.urlVersion}/teams/${this.getTeamId()}/channels/name/${channelName}`; + } + getChannelNeededRoute(channelId) { return `${this.url}${this.urlVersion}/teams/${this.getTeamId()}/channels/${channelId}`; } @@ -1042,6 +1046,17 @@ export default class Client { this.track('api', 'api_channels_join'); } + joinChannelByName = (name, success, error) => { + request. + post(`${this.getChannelNameRoute(name)}/join`). + set(this.defaultHeaders). + type('application/json'). + accept('application/json'). + end(this.handleResponse.bind(this, 'joinChannelByName', success, error)); + + this.track('api', 'api_channels_join_name'); + } + deleteChannel = (channelId, success, error) => { request. post(`${this.getChannelNeededRoute(channelId)}/delete`). @@ -1212,6 +1227,17 @@ export default class Client { this.track('api', 'api_posts_create', post.channel_id, 'length', post.message.length); } + // This is a temporary route to get around a problem with the permissions system that + // will be fixed in 3.1 or 3.2 + getPermalinkTmp = (postId, success, error) => { + request. + get(`${this.getTeamNeededRoute()}/pltmp/${postId}`). + set(this.defaultHeaders). + type('application/json'). + accept('application/json'). + end(this.handleResponse.bind(this, 'getPermalinkTmp', success, error)); + } + getPostById = (postId, success, error) => { request. get(`${this.getTeamNeededRoute()}/posts/${postId}`). -- cgit v1.2.3-1-g7c22