Move instances of Client.updateUserRoles() in components to an action (#4657)
* moved updateUserRoles to user_actions * updated second updateUserRoles call
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
ccf05bfdfe
Коммит
ad52183248
@@ -352,3 +352,22 @@ export function generateMfaSecret(success, error) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function updateUserRoles(userId, newRoles, success, error) {
|
||||||
|
Client.updateUserRoles(
|
||||||
|
userId,
|
||||||
|
newRoles,
|
||||||
|
() => {
|
||||||
|
AsyncClient.getUser(this.props.user.id);
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
success();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
if (error) {
|
||||||
|
error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import Client from 'client/web_client.jsx';
|
|||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
import * as AsyncClient from 'utils/async_client.jsx';
|
import * as AsyncClient from 'utils/async_client.jsx';
|
||||||
|
import {updateUserRoles} from 'actions/user_actions.jsx';
|
||||||
|
|
||||||
import {FormattedMessage} from 'react-intl';
|
import {FormattedMessage} from 'react-intl';
|
||||||
|
|
||||||
@@ -42,12 +43,10 @@ export default class AdminTeamMembersDropdown extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
doMakeMember() {
|
doMakeMember() {
|
||||||
Client.updateUserRoles(
|
updateUserRoles(
|
||||||
this.props.user.id,
|
this.props.user.id,
|
||||||
'system_user',
|
'system_user',
|
||||||
() => {
|
null,
|
||||||
AsyncClient.getUser(this.props.user.id);
|
|
||||||
},
|
|
||||||
(err) => {
|
(err) => {
|
||||||
this.setState({serverError: err.message});
|
this.setState({serverError: err.message});
|
||||||
}
|
}
|
||||||
@@ -142,12 +141,10 @@ export default class AdminTeamMembersDropdown extends React.Component {
|
|||||||
handleMakeSystemAdmin(e) {
|
handleMakeSystemAdmin(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
Client.updateUserRoles(
|
updateUserRoles(
|
||||||
this.props.user.id,
|
this.props.user.id,
|
||||||
'system_user system_admin',
|
'system_user system_admin',
|
||||||
() => {
|
null,
|
||||||
AsyncClient.getUser(this.props.user.id);
|
|
||||||
},
|
|
||||||
(err) => {
|
(err) => {
|
||||||
this.setState({serverError: err.message});
|
this.setState({serverError: err.message});
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user