1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-25 08:59:31 -05:00

fix org owner cannot be removed if there is not in owner team (#3164)

This commit is contained in:
Lunny Xiao 2017-12-13 06:26:31 +08:00 committed by Lauris BH
parent 9f033bf2b5
commit 859b9ad7ea

View file

@ -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}
}
}
}