summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-05-09 16:01:25 -0400
committerGitHub <noreply@github.com>2017-05-09 16:01:25 -0400
commit6e642036f460fb2e28572d46ca29aa81fbc8c8d1 (patch)
tree6e3c7ab42000f66ffd4cab71359b2e56c4fb7fc3 /webapp
parent535eb14eeb344a64667ad18d514a93fa738b07b7 (diff)
downloadchat-6e642036f460fb2e28572d46ca29aa81fbc8c8d1.tar.gz
chat-6e642036f460fb2e28572d46ca29aa81fbc8c8d1.tar.bz2
chat-6e642036f460fb2e28572d46ca29aa81fbc8c8d1.zip
Show team in sidebar when joining through login (#6358)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/actions/team_actions.jsx23
1 files changed, 23 insertions, 0 deletions
diff --git a/webapp/actions/team_actions.jsx b/webapp/actions/team_actions.jsx
index 44b554ded..6407e1b12 100644
--- a/webapp/actions/team_actions.jsx
+++ b/webapp/actions/team_actions.jsx
@@ -28,6 +28,9 @@ import {
getTeamMembersForUser as getTeamMembersForUserRedux
} from 'mattermost-redux/actions/teams';
+import {TeamTypes} from 'mattermost-redux/action_types';
+import {batchActions} from 'redux-batched-actions';
+
export function checkIfTeamExists(teamName, onSuccess, onError) {
checkIfTeamExistsRedux(teamName)(dispatch, getState).then(
(exists) => {
@@ -104,6 +107,26 @@ export function addUserToTeamFromInvite(data, hash, inviteId, success, error) {
hash,
inviteId,
(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
+ }
+ ]));
+
if (success) {
success(team);
}