diff options
Diffstat (limited to 'webapp/actions/websocket_actions.jsx')
-rw-r--r-- | webapp/actions/websocket_actions.jsx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx index 4d2b5a2b5..f85c32479 100644 --- a/webapp/actions/websocket_actions.jsx +++ b/webapp/actions/websocket_actions.jsx @@ -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); } |