diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-06-07 17:43:06 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-06-07 17:43:06 -0400 |
commit | 68c2b070da59bd2cf9c5cd91901a4e3bf6084061 (patch) | |
tree | 40b28fa96f65931a9c9e29724bf161c970e37362 /api/user.go | |
parent | 52b5db3a0b5d2ed3b96a72d8e8865d61d865320e (diff) | |
download | chat-68c2b070da59bd2cf9c5cd91901a4e3bf6084061.tar.gz chat-68c2b070da59bd2cf9c5cd91901a4e3bf6084061.tar.bz2 chat-68c2b070da59bd2cf9c5cd91901a4e3bf6084061.zip |
Auto join teams if coming from team sign-up page to login for GitLab (#3284)
Diffstat (limited to 'api/user.go')
-rw-r--r-- | api/user.go | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/api/user.go b/api/user.go index de7a560bf..aae3dffa5 100644 --- a/api/user.go +++ b/api/user.go @@ -285,11 +285,6 @@ func CreateOAuthUser(c *Context, w http.ResponseWriter, r *http.Request, service suchan := Srv.Store.User().GetByAuth(user.AuthData, service) euchan := Srv.Store.User().GetByEmail(user.Email) - var tchan store.StoreChannel - if len(teamId) != 0 { - tchan = Srv.Store.Team().Get(teamId) - } - found := true count := 0 for found { @@ -319,20 +314,14 @@ func CreateOAuthUser(c *Context, w http.ResponseWriter, r *http.Request, service return nil } - if tchan != nil { - if result := <-tchan; result.Err != nil { - c.Err = result.Err + if len(teamId) > 0 { + err = JoinUserToTeamById(teamId, user) + if err != nil { + c.Err = err return nil - } else { - team := result.Data.(*model.Team) - err = JoinUserToTeam(team, user) - if err != nil { - c.Err = err - return nil - } - - go addDirectChannels(team.Id, user) } + + go addDirectChannels(teamId, user) } doLogin(c, w, r, ruser, "") |