aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-07-14 08:22:09 +0100
committerGitHub <noreply@github.com>2022-07-14 08:22:09 +0100
commitbffa30302070b594a1c40cdc56264b9731036fb3 (patch)
tree92104ff6b8a51f5d1506742427dd1399fa42428c /models/repo.go
parent175705356cac06c22d13d86b31605a6ad6dd9642 (diff)
downloadgitea-bffa30302070b594a1c40cdc56264b9731036fb3.tar.gz
gitea-bffa30302070b594a1c40cdc56264b9731036fb3.zip
Add option to purge users (#18064)
Add the ability to purge users when deleting them. Close #15588 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go12
1 files changed, 2 insertions, 10 deletions
diff --git a/models/repo.go b/models/repo.go
index ca83b03e42..66ef514739 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -342,16 +342,8 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error {
}
}
- projects, _, err := project_model.GetProjects(ctx, project_model.SearchOptions{
- RepoID: repoID,
- })
- if err != nil {
- return fmt.Errorf("get projects: %v", err)
- }
- for i := range projects {
- if err := project_model.DeleteProjectByIDCtx(ctx, projects[i].ID); err != nil {
- return fmt.Errorf("delete project [%d]: %v", projects[i].ID, err)
- }
+ if err := project_model.DeleteProjectByRepoIDCtx(ctx, repoID); err != nil {
+ return fmt.Errorf("unable to delete projects for repo[%d]: %v", repoID, err)
}
// Remove LFS objects