Commit 41518a46 authored by Vinnie Okada's avatar Vinnie Okada

Remove :keep_repo option

Always delete repositories from the filesystem when deleting a project.
parent 68b5ac7f
......@@ -100,8 +100,7 @@ class ProjectsController < ApplicationController
def destroy
return access_denied! unless can?(current_user, :remove_project, project)
::Projects::DestroyService.new(@project, current_user,
keep_repo: params[:keep_repo]).execute
::Projects::DestroyService.new(@project, current_user, {}).execute
respond_to do |format|
format.html do
......
......@@ -6,10 +6,7 @@ module Projects
project.team.truncate
project.repository.expire_cache unless project.empty_repo?
result = project.destroy
return false unless result
unless params[:keep_repo]
if project.destroy
GitlabShellWorker.perform_async(
:remove_repository,
project.path_with_namespace
......@@ -21,11 +18,11 @@ module Projects
)
project.satellite.destroy
end
log_info("Project \"#{project.name}\" was removed")
system_hook_service.execute_hooks_for(project, :destroy)
result
true
end
end
end
end
......@@ -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
......
......@@ -641,16 +641,6 @@ describe API::API, api: true do
response.status.should == 200
end
it 'should keep repo when "keep_repo" param is true' do
expect(GitlabShellWorker).not_to(
receive(:perform_async).with(:remove_repository,
/#{project.path_with_namespace}/)
)
delete api("/projects/#{project.id}?keep_repo=true", user)
response.status.should == 200
end
it "should not remove a project if not an owner" do
user3 = create(:user)
project.team << [user3, :developer]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment