mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-04 13:50:39 +00:00
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>
This commit is contained in:
parent
175705356c
commit
bffa303020
16 changed files with 221 additions and 51 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue