mirror of
https://github.com/go-gitea/gitea
synced 2025-08-15 14:08:28 +00:00
Backport #21983 Fix #21772 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: 花墨 <shanee@live.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
This commit is contained in:
@@ -108,13 +108,20 @@ func MembersAction(ctx *context.Context) {
|
||||
}
|
||||
case "leave":
|
||||
err = models.RemoveOrgUser(org.ID, ctx.Doer.ID)
|
||||
if organization.IsErrLastOrgOwner(err) {
|
||||
if err == nil {
|
||||
ctx.Flash.Success(ctx.Tr("form.organization_leave_success", org.DisplayName()))
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
"redirect": "", // keep the user stay on current page, in case they want to do other operations.
|
||||
})
|
||||
} else if organization.IsErrLastOrgOwner(err) {
|
||||
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
"redirect": ctx.Org.OrgLink + "/members",
|
||||
})
|
||||
return
|
||||
} else {
|
||||
log.Error("RemoveOrgUser(%d,%d): %v", org.ID, ctx.Doer.ID, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user