Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
* Rename removeUserFromTeam action to removeUserFromTeamAndGetStats
Browse files Browse the repository at this point in the history
  • Loading branch information
sudheerDev committed Dec 12, 2018
1 parent 8be3dd1 commit 2de732d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion actions/team_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {getUser} from 'mattermost-redux/actions/users';

import {browserHistory} from 'utils/browser_history';

export function removeUserFromTeam(teamId, userId) {
export function removeUserFromTeamAndGetStats(teamId, userId) {
return async (dispatch, getState) => {
const response = await dispatch(TeamActions.removeUserFromTeam(teamId, userId));
dispatch(getUser(userId));
Expand Down
3 changes: 1 addition & 2 deletions components/admin_console/manage_teams_modal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';

import {updateTeamMemberSchemeRoles, getTeamMembersForUser, getTeamsForUser} from 'mattermost-redux/actions/teams';
import {removeUserFromTeam} from 'mattermost-redux/actions/teams';
import {updateTeamMemberSchemeRoles, getTeamMembersForUser, getTeamsForUser, removeUserFromTeam} from 'mattermost-redux/actions/teams';

import {getCurrentLocale} from 'selectors/i18n';

Expand Down
4 changes: 2 additions & 2 deletions components/team_members_dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentRelativeTeamUrl} from 'mattermost-redux/selectors/entities/teams';

import {removeUserFromTeam} from 'actions/team_actions.jsx';
import {removeUserFromTeamAndGetStats} from 'actions/team_actions.jsx';

import TeamMembersDropdown from './team_members_dropdown.jsx';

Expand All @@ -30,7 +30,7 @@ function mapDispatchToProps(dispatch) {
getTeamStats,
getChannelStats,
updateTeamMemberSchemeRoles,
removeUserFromTeam,
removeUserFromTeamAndGetStats,
}, dispatch),
};
}
Expand Down
2 changes: 1 addition & 1 deletion components/team_members_dropdown/team_members_dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class TeamMembersDropdown extends React.Component {
}

handleRemoveFromTeam = async () => {
const {data, error} = await this.props.actions.removeUserFromTeam(this.props.teamMember.team_id, this.props.user.id);
const {error} = await this.props.actions.removeUserFromTeam(this.props.teamMember.team_id, this.props.user.id);
if (error) {
this.setState({serverError: error.message});
}
Expand Down
4 changes: 2 additions & 2 deletions tests/redux/actions/team_actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ describe('Actions.Team', () => {
expect(TeamActions.addUsersToTeam).toHaveBeenCalledWith('teamId', ['123', '1234']);
});

test('removeUserFromTeam', async () => {
await testStore.dispatch(Actions.removeUserFromTeam('teamId', '123'));
test('removeUserFromTeamAndGetStats', async () => {
await testStore.dispatch(Actions.removeUserFromTeamAndGetStats('teamId', '123'));
expect(userActions.getUser).toHaveBeenCalledWith('123');
expect(TeamActions.getTeamStats).toHaveBeenCalledWith('teamId');
expect(channelActions.getChannelStats).toHaveBeenCalledWith('currentChannelId');
Expand Down

0 comments on commit 2de732d

Please sign in to comment.