mirror of
https://github.com/go-gitea/gitea
synced 2024-11-25 17:02:50 +01:00
fix org owner cannot be removed if there is not in owner team (#3164)
This commit is contained in:
parent
9f033bf2b5
commit
859b9ad7ea
1 changed files with 6 additions and 1 deletions
|
@ -453,9 +453,14 @@ func RemoveOrgUser(orgID, userID int64) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if t.NumMembers == 1 {
|
if t.NumMembers == 1 {
|
||||||
|
if err := t.GetMembers(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if t.Members[0].ID == userID {
|
||||||
return ErrLastOrgOwner{UID: userID}
|
return ErrLastOrgOwner{UID: userID}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sess := x.NewSession()
|
sess := x.NewSession()
|
||||||
defer sess.Close()
|
defer sess.Close()
|
||||||
|
|
Loading…
Reference in a new issue