MCPcopy Create free account
hub / github.com/gogs/gogs / SettingsLeaveOrganization

Function SettingsLeaveOrganization

internal/route/user/setting.go:575–588  ·  view source on GitHub ↗
(c *context.Context)

Source from the content-addressed store, hash-verified

573}
574
575func SettingsLeaveOrganization(c *context.Context) {
576 if err := database.RemoveOrgUser(c.QueryInt64("id"), c.User.ID); err != nil {
577 if database.IsErrLastOrgOwner(err) {
578 c.Flash.Error(c.Tr("form.last_org_owner"))
579 } else {
580 c.Errorf(err, "remove organization user")
581 return
582 }
583 }
584
585 c.JSONSuccess(map[string]any{
586 "redirect": conf.Server.Subpath + "/user/settings/organizations",
587 })
588}
589
590func (h *SettingsHandler) Applications() macaron.Handler {
591 return func(c *context.Context) {

Callers

nothing calls this directly

Calls 6

RemoveOrgUserFunction · 0.92
IsErrLastOrgOwnerFunction · 0.92
TrMethod · 0.80
JSONSuccessMethod · 0.80
ErrorMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected