|
|
@ -442,12 +442,14 @@ func SettingsOrganizations(ctx *context.Context) { |
|
|
|
|
|
|
|
|
|
|
|
func SettingsLeaveOrganization(ctx *context.Context) { |
|
|
|
func SettingsLeaveOrganization(ctx *context.Context) { |
|
|
|
err := models.RemoveOrgUser(ctx.QueryInt64("id"), ctx.User.ID) |
|
|
|
err := models.RemoveOrgUser(ctx.QueryInt64("id"), ctx.User.ID) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
if models.IsErrLastOrgOwner(err) { |
|
|
|
if models.IsErrLastOrgOwner(err) { |
|
|
|
ctx.Flash.Error(ctx.Tr("form.last_org_owner")) |
|
|
|
ctx.Flash.Error(ctx.Tr("form.last_org_owner")) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ctx.Handle(500, "RemoveOrgUser", err) |
|
|
|
ctx.Handle(500, "RemoveOrgUser", err) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ctx.JSON(200, map[string]interface{}{ |
|
|
|
ctx.JSON(200, map[string]interface{}{ |
|
|
|
"redirect": setting.AppSubUrl + "/user/settings/organizations", |
|
|
|
"redirect": setting.AppSubUrl + "/user/settings/organizations", |
|
|
|