diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-06-26 13:25:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-26 13:25:43 -0400 |
commit | 82b36b3721d6ee129d27c3fc3957d4e37643d4a6 (patch) | |
tree | e43d5cdb6e008149196781b4cd9146ce14447ac5 /webapp/actions/team_actions.jsx | |
parent | 072da672a8bd62d730977a73966274b47ea9e0de (diff) | |
download | chat-82b36b3721d6ee129d27c3fc3957d4e37643d4a6.tar.gz chat-82b36b3721d6ee129d27c3fc3957d4e37643d4a6.tar.bz2 chat-82b36b3721d6ee129d27c3fc3957d4e37643d4a6.zip |
PLT-6815 Do not disconnect websocket when joining a team (#6746)
* Do not disconnect websocket when joining a team
* Fix eslint error
Diffstat (limited to 'webapp/actions/team_actions.jsx')
-rw-r--r-- | webapp/actions/team_actions.jsx | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/webapp/actions/team_actions.jsx b/webapp/actions/team_actions.jsx index a0d208301..af132b139 100644 --- a/webapp/actions/team_actions.jsx +++ b/webapp/actions/team_actions.jsx @@ -18,7 +18,6 @@ import {viewChannel} from 'mattermost-redux/actions/channels'; import * as TeamActions from 'mattermost-redux/actions/teams'; import {TeamTypes} from 'mattermost-redux/action_types'; -import {batchActions} from 'redux-batched-actions'; export function checkIfTeamExists(teamName, onSuccess, onError) { TeamActions.checkIfTeamExists(teamName)(dispatch, getState).then( @@ -92,30 +91,24 @@ export function updateTeamMemberRoles(teamId, userId, newRoles, success, error) export function addUserToTeamFromInvite(data, hash, inviteId, success, error) { Client4.addToTeamFromInvite(hash, data, inviteId).then( - (team) => { - const member = { - team_id: team.id, - user_id: getState().entities.users.currentUserId, - roles: 'team_user', - delete_at: 0, - msg_count: 0, - mention_count: 0 - }; - - dispatch(batchActions([ - { - type: TeamTypes.RECEIVED_TEAMS_LIST, - data: [team] - }, - { - type: TeamTypes.RECEIVED_MY_TEAM_MEMBER, - data: member + (member) => { + TeamActions.getTeam(member.team_id)(dispatch, getState).then( + (team) => { + dispatch({ + type: TeamTypes.RECEIVED_MY_TEAM_MEMBER, + data: { + ...member, + delete_at: 0, + msg_count: 0, + mention_count: 0 + } + }); + + if (success) { + success(team); + } } - ])); - - if (success) { - success(team); - } + ); }, ).catch( (err) => { |