user/settings: fix bad error handle of leave organization

pull/4343/head
Unknwon 2017-03-25 03:44:12 -04:00
parent 8f52ab8201
commit 78f94986e3
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
1 changed files with 7 additions and 5 deletions

View File

@ -442,11 +442,13 @@ func SettingsOrganizations(ctx *context.Context) {
func SettingsLeaveOrganization(ctx *context.Context) {
err := models.RemoveOrgUser(ctx.QueryInt64("id"), ctx.User.ID)
if models.IsErrLastOrgOwner(err) {
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
} else {
ctx.Handle(500, "RemoveOrgUser", err)
return
if err != nil {
if models.IsErrLastOrgOwner(err) {
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
} else {
ctx.Handle(500, "RemoveOrgUser", err)
return
}
}
ctx.JSON(200, map[string]interface{}{