aboutsummaryrefslogtreecommitdiff
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-03-25 03:44:12 -0400
committerUnknwon <u@gogs.io>2017-03-25 03:44:12 -0400
commit78f94986e383ac2bb6d11157b652f09496b673f5 (patch)
tree0604fc96c1f7656897f1803b932aa30ee32b424c /routers
parent8f52ab820106aac86fa5985bb5ba3ecc22b58725 (diff)
user/settings: fix bad error handle of leave organization
Diffstat (limited to 'routers')
-rw-r--r--routers/user/setting.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/routers/user/setting.go b/routers/user/setting.go
index b9d6c81e..9138ba04 100644
--- a/routers/user/setting.go
+++ b/routers/user/setting.go
@@ -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{}{