diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-12-13 06:26:31 +0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-12-13 00:26:31 +0200 |
commit | 859b9ad7ea8c4d7a5b2b448def361702213c5677 (patch) | |
tree | d99884c4607c7577c1d602d317928d9fc19be83b /models/org.go | |
parent | 9f033bf2b5ca789329c18a311359c182ffd0e55b (diff) | |
download | gitea-859b9ad7ea8c4d7a5b2b448def361702213c5677.tar.gz gitea-859b9ad7ea8c4d7a5b2b448def361702213c5677.zip |
fix org owner cannot be removed if there is not in owner team (#3164)
Diffstat (limited to 'models/org.go')
-rw-r--r-- | models/org.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/models/org.go b/models/org.go index 4a4fcb4add..b349e4c170 100644 --- a/models/org.go +++ b/models/org.go @@ -453,7 +453,12 @@ func RemoveOrgUser(orgID, userID int64) error { return err } if t.NumMembers == 1 { - return ErrLastOrgOwner{UID: userID} + if err := t.GetMembers(); err != nil { + return err + } + if t.Members[0].ID == userID { + return ErrLastOrgOwner{UID: userID} + } } } |