Fix updating team admin status
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-08-05 17:28:11 +02:00
parent 11722bf029
commit 6a82d4e2af
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 5 additions and 3 deletions

View File

@ -117,18 +117,20 @@ func (tm *TeamMember) Update() (err error) {
tm.UserID = user.ID
// Get the full member object and change the admin right
ttm := &TeamMember{}
_, err = x.
Where("team_id = ? AND user_id = ?", tm.TeamID, tm.UserID).
Get(tm)
Get(ttm)
if err != nil {
return err
}
tm.Admin = !tm.Admin
ttm.Admin = !ttm.Admin
// Do the update
_, err = x.
Where("team_id = ? AND user_id = ?", tm.TeamID, tm.UserID).
Cols("admin").
Update(tm)
Update(ttm)
tm.Admin = ttm.Admin // Since we're returning the updated rights object
return
}