aboutsummaryrefslogtreecommitdiffstats
path: root/models/org.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-12-13 06:26:31 +0800
committerLauris BH <lauris@nix.lv>2017-12-13 00:26:31 +0200
commit859b9ad7ea8c4d7a5b2b448def361702213c5677 (patch)
treed99884c4607c7577c1d602d317928d9fc19be83b /models/org.go
parent9f033bf2b5ca789329c18a311359c182ffd0e55b (diff)
downloadgitea-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.go7
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}
+ }
}
}