diff options
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) => { |