diff options
author | Corey Hulen <corey@hulen.com> | 2016-08-17 07:18:11 -0800 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-08-17 11:18:11 -0400 |
commit | fdda090ca231af8faf5e3cbfb4c1b4af86120590 (patch) | |
tree | fb28dcbcb90a9fb129cd1483ccedaef5dd0f2893 /api | |
parent | eafc8028314805ded314648e02078cf596760197 (diff) | |
download | chat-fdda090ca231af8faf5e3cbfb4c1b4af86120590.tar.gz chat-fdda090ca231af8faf5e3cbfb4c1b4af86120590.tar.bz2 chat-fdda090ca231af8faf5e3cbfb4c1b4af86120590.zip |
PLT-3822 after admin leaves team he cannot get admin access anymore (#3814)
Diffstat (limited to 'api')
-rw-r--r-- | api/team.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/api/team.go b/api/team.go index 20a0671da..7f84f8263 100644 --- a/api/team.go +++ b/api/team.go @@ -261,10 +261,6 @@ func JoinUserToTeam(team *model.Team, user *model.User) *model.AppError { tm := &model.TeamMember{TeamId: team.Id, UserId: user.Id} channelRole := "" - if team.Email == user.Email { - tm.Roles = model.ROLE_TEAM_ADMIN - channelRole = model.CHANNEL_ROLE_ADMIN - } if etmr := <-Srv.Store.Team().GetMember(team.Id, user.Id); etmr.Err == nil { // Membership alredy exists. Check if deleted and and update, otherwise do nothing @@ -279,6 +275,11 @@ func JoinUserToTeam(team *model.Team, user *model.User) *model.AppError { return tmr.Err } } else { + if team.Email == user.Email { + tm.Roles = model.ROLE_TEAM_ADMIN + channelRole = model.CHANNEL_ROLE_ADMIN + } + // Membership appears to be missing. Lets try to add. if tmr := <-Srv.Store.Team().SaveMember(tm); tmr.Err != nil { return tmr.Err |