* #4698 Move instances of Client.updateActive() in components to an action * Use null for empty success function
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
cadc9e11e4
Коммит
f0f5326098
@@ -432,3 +432,20 @@ export function checkMfa(loginId, success, error) {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function updateActive(userId, active, success, error) {
|
||||
Client.updateActive(userId, active,
|
||||
() => {
|
||||
AsyncClient.getUser(userId);
|
||||
|
||||
if (success) {
|
||||
success();
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
if (error) {
|
||||
error(err);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import Client from 'client/web_client.jsx';
|
||||
import Constants from 'utils/constants.jsx';
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
import * as AsyncClient from 'utils/async_client.jsx';
|
||||
import {updateUserRoles} from 'actions/user_actions.jsx';
|
||||
import {updateUserRoles, updateActive} from 'actions/user_actions.jsx';
|
||||
|
||||
import {FormattedMessage} from 'react-intl';
|
||||
|
||||
@@ -92,10 +92,7 @@ export default class AdminTeamMembersDropdown extends React.Component {
|
||||
|
||||
handleMakeActive(e) {
|
||||
e.preventDefault();
|
||||
Client.updateActive(this.props.user.id, true,
|
||||
() => {
|
||||
AsyncClient.getUser(this.props.user.id);
|
||||
},
|
||||
updateActive(this.props.user.id, true, null,
|
||||
(err) => {
|
||||
this.setState({serverError: err.message});
|
||||
}
|
||||
@@ -104,10 +101,7 @@ export default class AdminTeamMembersDropdown extends React.Component {
|
||||
|
||||
handleMakeNotActive(e) {
|
||||
e.preventDefault();
|
||||
Client.updateActive(this.props.user.id, false,
|
||||
() => {
|
||||
AsyncClient.getUser(this.props.user.id);
|
||||
},
|
||||
updateActive(this.props.user.id, false, null,
|
||||
(err) => {
|
||||
this.setState({serverError: err.message});
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import UserStore from 'stores/user_store.jsx';
|
||||
import ChannelStore from 'stores/channel_store.jsx';
|
||||
|
||||
import {removeUserFromTeam} 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';
|
||||
@@ -74,9 +75,8 @@ export default class TeamMembersDropdown extends React.Component {
|
||||
}
|
||||
|
||||
handleMakeActive() {
|
||||
Client.updateActive(this.props.user.id, true,
|
||||
updateActive(this.props.user.id, true,
|
||||
() => {
|
||||
AsyncClient.getUser(this.props.user.id);
|
||||
AsyncClient.getChannelStats(ChannelStore.getCurrentId());
|
||||
AsyncClient.getTeamStats(this.props.teamMember.team_id);
|
||||
},
|
||||
@@ -87,9 +87,8 @@ export default class TeamMembersDropdown extends React.Component {
|
||||
}
|
||||
|
||||
handleMakeNotActive() {
|
||||
Client.updateActive(this.props.user.id, false,
|
||||
updateActive(this.props.user.id, false,
|
||||
() => {
|
||||
AsyncClient.getUser(this.props.user.id);
|
||||
AsyncClient.getChannelStats(ChannelStore.getCurrentId());
|
||||
AsyncClient.getTeamStats(this.props.teamMember.team_id);
|
||||
},
|
||||
|
||||
Ссылка в новой задаче
Block a user