Fix getting removed from channel or team (#6357)

Этот коммит содержится в:
Joram Wilander
2017-05-09 05:24:53 -05:00
коммит произвёл George Goldberg
родитель 52b5c74a0f
Коммит fb4d72bd8a

Просмотреть файл

@@ -34,9 +34,10 @@ import {browserHistory} from 'react-router/es6';
import store from 'stores/redux_store.jsx';
const dispatch = store.dispatch;
const getState = store.getState;
import {batchActions} from 'redux-batched-actions';
import {viewChannel, getChannelAndMyMember, getChannelStats} from 'mattermost-redux/actions/channels';
import {setServerVersion} from 'mattermost-redux/actions/general';
import {ChannelTypes} from 'mattermost-redux/action_types';
import {ChannelTypes, TeamTypes, UserTypes} from 'mattermost-redux/action_types';
const MAX_WEBSOCKET_FAILS = 7;
@@ -294,6 +295,18 @@ function handleLeaveTeamEvent(msg) {
GlobalActions.redirectUserToDefaultTeam();
}
}
dispatch(batchActions([
{
type: UserTypes.RECEIVED_PROFILE_NOT_IN_TEAM,
data: {user_id: msg.data.user_id},
id: msg.data.team_id
},
{
type: TeamTypes.REMOVE_MEMBER_FROM_TEAM,
data: {team_id: msg.data.team_id, user_id: msg.data.user_id}
}
]));
} else {
UserStore.removeProfileFromTeam(msg.data.team_id, msg.data.user_id);
TeamStore.removeMemberInTeam(msg.data.team_id, msg.data.user_id);
@@ -334,6 +347,11 @@ function handleUserRemovedEvent(msg) {
BrowserStore.setItem('channel-removed-state', sentState);
$('#removed_from_channel').modal('show');
}
dispatch({
type: ChannelTypes.LEAVE_CHANNEL,
data: {id: msg.data.channel_id, user_id: msg.broadcast.user_id}
});
} else if (ChannelStore.getCurrentId() === msg.broadcast.channel_id) {
getChannelStats(ChannelStore.getCurrentId())(dispatch, getState);
}