diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-09-22 08:31:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-22 08:31:38 -0400 |
commit | efdb0dfa0b422b24a6fbed2c4752484494a78857 (patch) | |
tree | de94d8ae0f9e6c9bc91e504d93dc7f55219da52f /webapp/client | |
parent | de79343b9aa9dc601e5633cef329e1a83452aa1a (diff) | |
download | chat-efdb0dfa0b422b24a6fbed2c4752484494a78857.tar.gz chat-efdb0dfa0b422b24a6fbed2c4752484494a78857.tar.bz2 chat-efdb0dfa0b422b24a6fbed2c4752484494a78857.zip |
Fixing update roles API (#4060)
Diffstat (limited to 'webapp/client')
-rw-r--r-- | webapp/client/client.jsx | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/webapp/client/client.jsx b/webapp/client/client.jsx index 544eb4980..4cd9c7c7c 100644 --- a/webapp/client/client.jsx +++ b/webapp/client/client.jsx @@ -77,6 +77,10 @@ export default class Client { return `${this.url}${this.urlVersion}/teams/${this.getTeamId()}`; } + getTeamNeededManualRoute(teamId) { + return `${this.url}${this.urlVersion}/teams/${teamId}`; + } + getChannelsRoute() { return `${this.url}${this.urlVersion}/teams/${this.getTeamId()}/channels`; } @@ -709,22 +713,37 @@ export default class Client { this.track('api', 'api_users_update_notification_settings'); } - updateRoles(teamId, userId, newRoles, success, error) { + updateUserRoles(userId, newRoles, success, error) { + var data = { + new_roles: newRoles + }; + + request. + post(`${this.getUserNeededRoute(userId)}/update_roles`). + set(this.defaultHeaders). + type('application/json'). + accept('application/json'). + send(data). + end(this.handleResponse.bind(this, 'updateUserRoles', success, error)); + + this.track('api', 'api_users_update_user_roles'); + } + + updateTeamMemberRoles(teamId, userId, newRoles, success, error) { var data = { - team_id: teamId, user_id: userId, new_roles: newRoles }; request. - post(`${this.getUsersRoute()}/update_roles`). + post(`${this.getTeamNeededManualRoute(teamId)}/update_member_roles`). set(this.defaultHeaders). type('application/json'). accept('application/json'). send(data). - end(this.handleResponse.bind(this, 'updateRoles', success, error)); + end(this.handleResponse.bind(this, 'updateTeamMemberRoles', success, error)); - this.track('api', 'api_users_update_roles'); + this.track('api', 'api_teams_update_member_roles'); } updateActive(userId, active, success, error) { @@ -740,7 +759,7 @@ export default class Client { send(data). end(this.handleResponse.bind(this, 'updateActive', success, error)); - this.track('api', 'api_users_update_roles'); + this.track('api', 'api_users_update_active'); } sendPasswordReset(email, success, error) { |