From 68b5ac7f185b9b30cd862eacf806db726d8ce6e4 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Tue, 7 Oct 2014 14:55:15 -0500 Subject: Add option to keep repo on project delete Update the project API controller to use `Projects::DestroyService` instead of calling `Project#destroy` directly. Also add an optional parameter, `:keep_repo`, that allows a project to be deleted without deleting the repository, wiki, and satellite from disk. --- lib/api/projects.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/api/projects.rb') diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 7f7d2f8e9a8..e70548d1e85 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -174,11 +174,17 @@ module API # # Parameters: # id (required) - The ID of a project + # keep_repo (optional) - If true, then delete the project from the + # database but keep the repo, wiki, and satellite on disk. # Example Request: # DELETE /projects/:id delete ":id" do authorize! :remove_project, user_project - user_project.destroy + ::Projects::DestroyService.new( + user_project, + current_user, + keep_repo: params[:keep_repo] + ).execute end # Mark this project as forked from another -- cgit v1.2.1 From 41518a467dcef61deca24ad2f6205c6fd5706e1b Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Wed, 22 Oct 2014 21:08:19 -0500 Subject: Remove :keep_repo option Always delete repositories from the filesystem when deleting a project. --- lib/api/projects.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'lib/api/projects.rb') diff --git a/lib/api/projects.rb b/lib/api/projects.rb index e70548d1e85..7fcf97d1ad6 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -174,17 +174,11 @@ module API # # Parameters: # id (required) - The ID of a project - # keep_repo (optional) - If true, then delete the project from the - # database but keep the repo, wiki, and satellite on disk. # Example Request: # DELETE /projects/:id delete ":id" do authorize! :remove_project, user_project - ::Projects::DestroyService.new( - user_project, - current_user, - keep_repo: params[:keep_repo] - ).execute + ::Projects::DestroyService.new(user_project, current_user, {}).execute end # Mark this project as forked from another -- cgit v1.2.1