summaryrefslogtreecommitdiff
path: root/lib/api/projects.rb
diff options
context:
space:
mode:
authorVinnie Okada <vokada@mrvinn.com>2014-10-07 14:55:15 -0500
committerVinnie Okada <vokada@mrvinn.com>2014-10-07 15:21:00 -0500
commit68b5ac7f185b9b30cd862eacf806db726d8ce6e4 (patch)
treeadd984099eaa5706b2c2216b3a3ffab5c03f5d9b /lib/api/projects.rb
parent51ed8b7edd119897a4a0b2f5948d049dfc8691a4 (diff)
downloadgitlab-ce-68b5ac7f185b9b30cd862eacf806db726d8ce6e4.tar.gz
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.
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r--lib/api/projects.rb8
1 files changed, 7 insertions, 1 deletions
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