summaryrefslogtreecommitdiffstats
path: root/routers/web/org/setting.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-11-18 18:42:27 +0100
committerGitHub <noreply@github.com>2021-11-19 01:42:27 +0800
commitf34151bdb22c8160b0a6eafef20725ebae1768da (patch)
tree2abcc5845e4a9cf3769deb27ba5a3ecccd2ad8c9 /routers/web/org/setting.go
parent55be5fe3399d18b7d2477519707aecf5f99f1de5 (diff)
downloadgitea-f34151bdb22c8160b0a6eafef20725ebae1768da.tar.gz
gitea-f34151bdb22c8160b0a6eafef20725ebae1768da.zip
Move user/org deletion to services (#17673)
Diffstat (limited to 'routers/web/org/setting.go')
-rw-r--r--routers/web/org/setting.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go
index 53c31a1c60..f27cb40838 100644
--- a/routers/web/org/setting.go
+++ b/routers/web/org/setting.go
@@ -20,6 +20,7 @@ import (
"code.gitea.io/gitea/modules/web"
userSetting "code.gitea.io/gitea/routers/web/user/setting"
"code.gitea.io/gitea/services/forms"
+ "code.gitea.io/gitea/services/org"
)
const (
@@ -156,15 +157,14 @@ func SettingsDelete(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("org.settings")
ctx.Data["PageIsSettingsDelete"] = true
- org := ctx.Org.Organization
if ctx.Req.Method == "POST" {
- if org.Name != ctx.FormString("org_name") {
+ if ctx.Org.Organization.Name != ctx.FormString("org_name") {
ctx.Data["Err_OrgName"] = true
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_org_name"), tplSettingsDelete, nil)
return
}
- if err := models.DeleteOrganization(org); err != nil {
+ if err := org.DeleteOrganization(ctx.Org.Organization); err != nil {
if models.IsErrUserOwnRepos(err) {
ctx.Flash.Error(ctx.Tr("form.org_still_own_repo"))
ctx.Redirect(ctx.Org.OrgLink + "/settings/delete")
@@ -172,7 +172,7 @@ func SettingsDelete(ctx *context.Context) {
ctx.ServerError("DeleteOrganization", err)
}
} else {
- log.Trace("Organization deleted: %s", org.Name)
+ log.Trace("Organization deleted: %s", ctx.Org.Organization.Name)
ctx.Redirect(setting.AppSubURL + "/")
}
return