diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-10-07 08:30:57 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-10-07 08:30:57 -0400 |
commit | cf9ce772c2d27e6d0c848d47c6bdb7aaa626abb4 (patch) | |
tree | 535c0d674dd9d00c1586af15ac4667483274dfcc /web/react/components/member_list_team_item.jsx | |
parent | 2cd546370fe633c2b323dba510c2d0ee8a2a1788 (diff) | |
parent | 3b4b79d99f8795a26c38b843ca822f38e27ddc23 (diff) | |
download | chat-cf9ce772c2d27e6d0c848d47c6bdb7aaa626abb4.tar.gz chat-cf9ce772c2d27e6d0c848d47c6bdb7aaa626abb4.tar.bz2 chat-cf9ce772c2d27e6d0c848d47c6bdb7aaa626abb4.zip |
Merge pull request #947 from mattermost/PLT-435
PLT-435 adding ability to demote system admin
Diffstat (limited to 'web/react/components/member_list_team_item.jsx')
-rw-r--r-- | web/react/components/member_list_team_item.jsx | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/web/react/components/member_list_team_item.jsx b/web/react/components/member_list_team_item.jsx index b7e81f843..629fb2ec4 100644 --- a/web/react/components/member_list_team_item.jsx +++ b/web/react/components/member_list_team_item.jsx @@ -24,32 +24,32 @@ export default class MemberListTeamItem extends React.Component { }; Client.updateRoles(data, - function handleMakeMemberSuccess() { + () => { AsyncClient.getProfiles(); }, - function handleMakeMemberError(err) { + (err) => { this.setState({serverError: err.message}); - }.bind(this) + } ); } handleMakeActive() { Client.updateActive(this.props.user.id, true, - function handleMakeActiveSuccess() { + () => { AsyncClient.getProfiles(); }, - function handleMakeActiveError(err) { + (err) => { this.setState({serverError: err.message}); - }.bind(this) + } ); } handleMakeNotActive() { Client.updateActive(this.props.user.id, false, - function handleMakeNotActiveSuccess() { + () => { AsyncClient.getProfiles(); }, - function handleMakeNotActiveError(err) { + (err) => { this.setState({serverError: err.message}); - }.bind(this) + } ); } handleMakeAdmin() { @@ -59,12 +59,12 @@ export default class MemberListTeamItem extends React.Component { }; Client.updateRoles(data, - function handleMakeAdminSuccess() { + () => { AsyncClient.getProfiles(); }, - function handleMakeAdmitError(err) { + (err) => { this.setState({serverError: err.message}); - }.bind(this) + } ); } render() { @@ -82,14 +82,18 @@ export default class MemberListTeamItem extends React.Component { const timestamp = UserStore.getCurrentUser().update_at; if (user.roles.length > 0) { - currentRoles = user.roles.charAt(0).toUpperCase() + user.roles.slice(1); + if (user.roles.indexOf('system_admin') > -1) { + currentRoles = 'System Admin'; + } else { + currentRoles = user.roles.charAt(0).toUpperCase() + user.roles.slice(1); + } } const email = user.email; - let showMakeMember = user.roles === 'admin'; - let showMakeAdmin = user.roles === ''; + let showMakeMember = user.roles === 'admin' || user.roles === 'system_admin'; + let showMakeAdmin = user.roles === '' || user.roles === 'system_admin'; let showMakeActive = false; - let showMakeNotActive = true; + let showMakeNotActive = user.roles !== 'system_admin'; if (user.delete_at > 0) { currentRoles = 'Inactive'; @@ -108,7 +112,7 @@ export default class MemberListTeamItem extends React.Component { href='#' onClick={this.handleMakeAdmin} > - Make Admin + {'Make Admin'} </a> </li> ); @@ -123,7 +127,7 @@ export default class MemberListTeamItem extends React.Component { href='#' onClick={this.handleMakeMember} > - Make Member + {'Make Member'} </a> </li> ); @@ -138,7 +142,7 @@ export default class MemberListTeamItem extends React.Component { href='#' onClick={this.handleMakeActive} > - Make Active + {'Make Active'} </a> </li> ); @@ -153,7 +157,7 @@ export default class MemberListTeamItem extends React.Component { href='#' onClick={this.handleMakeNotActive} > - Make Inactive + {'Make Inactive'} </a> </li> ); |