summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-05-09 05:24:53 -0500
committerGeorge Goldberg <george@gberg.me>2017-05-09 11:24:53 +0100
commitfb4d72bd8a3a9b533571e42cfb1b7e2d1702f6be (patch)
tree6230821c21ad12b10cf22ab900cefe28203ab658 /webapp
parent52b5c74a0f0a5cee8577976b46928c7fe3a45979 (diff)
downloadchat-fb4d72bd8a3a9b533571e42cfb1b7e2d1702f6be.tar.gz
chat-fb4d72bd8a3a9b533571e42cfb1b7e2d1702f6be.tar.bz2
chat-fb4d72bd8a3a9b533571e42cfb1b7e2d1702f6be.zip
Fix getting removed from channel or team (#6357)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/actions/websocket_actions.jsx20
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);
}