From 84c6e376fab7de7d74c103a5dea49f331e827311 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Roland?= <bjoernr-de@users.noreply.github.com>
Date: Thu, 22 Dec 2016 14:46:13 +0100
Subject: #4695 Move instances of Client.updateTeamMemberRoles() in components
 to an action (#4870)

---
 webapp/components/team_members_dropdown.jsx | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

(limited to 'webapp/components/team_members_dropdown.jsx')

diff --git a/webapp/components/team_members_dropdown.jsx b/webapp/components/team_members_dropdown.jsx
index 1961d6b5a..f2f7727a3 100644
--- a/webapp/components/team_members_dropdown.jsx
+++ b/webapp/components/team_members_dropdown.jsx
@@ -7,10 +7,9 @@ import TeamStore from 'stores/team_store.jsx';
 import UserStore from 'stores/user_store.jsx';
 import ChannelStore from 'stores/channel_store.jsx';
 
-import {removeUserFromTeam} from 'actions/team_actions.jsx';
+import {removeUserFromTeam, updateTeamMemberRoles} from 'actions/team_actions.jsx';
 import {updateActive} from 'actions/user_actions.jsx';
 
-import Client from 'client/web_client.jsx';
 import * as AsyncClient from 'utils/async_client.jsx';
 import * as Utils from 'utils/utils.jsx';
 
@@ -44,12 +43,11 @@ export default class TeamMembersDropdown extends React.Component {
         if (this.props.user.id === me.id && me.roles.includes('system_admin')) {
             this.handleDemote(this.props.user, 'team_user');
         } else {
-            Client.updateTeamMemberRoles(
+            updateTeamMemberRoles(
                 this.props.teamMember.team_id,
                 this.props.user.id,
                 'team_user',
                 () => {
-                    AsyncClient.getTeamMember(this.props.teamMember.team_id, this.props.user.id);
                     AsyncClient.getUser(this.props.user.id);
                 },
                 (err) => {
@@ -103,12 +101,11 @@ export default class TeamMembersDropdown extends React.Component {
         if (this.props.user.id === me.id && me.roles.includes('system_admin')) {
             this.handleDemote(this.props.user, 'team_user team_admin');
         } else {
-            Client.updateTeamMemberRoles(
+            updateTeamMemberRoles(
                 this.props.teamMember.team_id,
                 this.props.user.id,
                 'team_user team_admin',
                 () => {
-                    AsyncClient.getTeamMember(this.props.teamMember.team_id, this.props.user.id);
                     AsyncClient.getUser(this.props.user.id);
                 },
                 (err) => {
@@ -139,12 +136,11 @@ export default class TeamMembersDropdown extends React.Component {
     }
 
     handleDemoteSubmit() {
-        Client.updateTeamMemberRoles(
+        updateTeamMemberRoles(
             this.props.teamMember.team_id,
             this.props.user.id,
             this.state.newRole,
             () => {
-                AsyncClient.getTeamMember(this.props.teamMember.team_id, this.props.user.id);
                 AsyncClient.getUser(this.props.user.id);
 
                 const teamUrl = TeamStore.getCurrentTeamUrl();
-- 
cgit v1.2.3-1-g7c22

