aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-10-19 15:16:11 +0200
committerGitHub <noreply@github.com>2023-10-19 13:16:11 +0000
commit3dc0c962bf3a74188bed02c01b4d34636112805a (patch)
tree588d9e7d8fbc3a4a862f466cada768558a09cc93 /routers
parent398eccb322f64dded83a119467af2cb38f6dbd46 (diff)
downloadgitea-3dc0c962bf3a74188bed02c01b4d34636112805a.tar.gz
gitea-3dc0c962bf3a74188bed02c01b4d34636112805a.zip
Delete repos of org when purge delete user (#27273)
Fixes https://codeberg.org/forgejo/forgejo/issues/1514 I had to remove `RenameOrganization` to avoid circular import. We should really add some foreign keys to the database.
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/org/org.go2
-rw-r--r--routers/web/org/setting.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go
index 4579f3b085..6fb8ecd403 100644
--- a/routers/api/v1/org/org.go
+++ b/routers/api/v1/org/org.go
@@ -385,7 +385,7 @@ func Delete(ctx *context.APIContext) {
// "404":
// "$ref": "#/responses/notFound"
- if err := org.DeleteOrganization(ctx, ctx.Org.Organization); err != nil {
+ if err := org.DeleteOrganization(ctx, ctx.Org.Organization, false); err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteOrganization", err)
return
}
diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go
index 2f2f7c14bd..fac83b3612 100644
--- a/routers/web/org/setting.go
+++ b/routers/web/org/setting.go
@@ -75,7 +75,7 @@ func SettingsPost(ctx *context.Context) {
// Check if organization name has been changed.
if nameChanged {
- err := org_service.RenameOrganization(ctx, org, form.Name)
+ err := user_service.RenameUser(ctx, org.AsUser(), form.Name)
switch {
case user_model.IsErrUserAlreadyExist(err):
ctx.Data["OrgName"] = true
@@ -180,7 +180,7 @@ func SettingsDelete(ctx *context.Context) {
return
}
- if err := org_service.DeleteOrganization(ctx, ctx.Org.Organization); err != nil {
+ if err := org_service.DeleteOrganization(ctx, ctx.Org.Organization, false); err != nil {
if models.IsErrUserOwnRepos(err) {
ctx.Flash.Error(ctx.Tr("form.org_still_own_repo"))
ctx.Redirect(ctx.Org.OrgLink + "/settings/delete")