summaryrefslogtreecommitdiffstats
path: root/services/user
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-09-08 06:51:15 +0200
committerGitHub <noreply@github.com>2023-09-08 06:51:15 +0200
commit4f32abaf941ba30ade1f96930a05d14f1c6a6782 (patch)
tree9351b7d654b20db032867041b0292924ec93bb3f /services/user
parentAdd `yamllint` (#26965) (diff)
downloadforgejo-4f32abaf941ba30ade1f96930a05d14f1c6a6782.tar.xz
forgejo-4f32abaf941ba30ade1f96930a05d14f1c6a6782.zip
move repository deletion to service layer (#26948)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'services/user')
-rw-r--r--services/user/user.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/services/user/user.go b/services/user/user.go
index bb3dd002ea..72bea0b468 100644
--- a/services/user/user.go
+++ b/services/user/user.go
@@ -26,6 +26,7 @@ import (
"code.gitea.io/gitea/services/agit"
"code.gitea.io/gitea/services/packages"
container_service "code.gitea.io/gitea/services/packages/container"
+ repo_service "code.gitea.io/gitea/services/repository"
)
// RenameUser renames a user
@@ -174,7 +175,7 @@ func DeleteUser(ctx context.Context, u *user_model.User, purge bool) error {
break
}
for _, repo := range repos {
- if err := models.DeleteRepository(u, u.ID, repo.ID); err != nil {
+ if err := repo_service.DeleteRepositoryDirectly(ctx, u, u.ID, repo.ID); err != nil {
return fmt.Errorf("unable to delete repository %s for %s[%d]. Error: %w", repo.Name, u.Name, u.ID, err)
}
}