Commit 2a40aa33 authored by Etienne Baqué's avatar Etienne Baqué

Merge branch '346165-hard-delete-snippets' into 'master'

Hard delete bulk snippets

See merge request gitlab-org/gitlab!82020
parents cec77404 2e739cee
......@@ -72,7 +72,9 @@ module Projects
end
def remove_snippets
response = ::Snippets::BulkDestroyService.new(current_user, project.snippets).execute
# We're setting the hard_delete param because we dont need to perform the access checks within the service since
# the user has enough access rights to remove the project and its resources.
response = ::Snippets::BulkDestroyService.new(current_user, project.snippets).execute(hard_delete: true)
if response.error?
log_error("Snippet deletion failed on #{project.full_path} with the following message: #{response.message}")
......
......@@ -437,11 +437,12 @@ RSpec.describe Projects::DestroyService, :aggregate_failures do
destroy_project(project, user)
end
it 'calls the bulk snippet destroy service' do
it 'calls the bulk snippet destroy service with the hard_delete param set to true' do
expect(project.snippets.count).to eq 2
expect(Snippets::BulkDestroyService).to receive(:new)
.with(user, project.snippets).and_call_original
expect_next_instance_of(Snippets::BulkDestroyService, user, project.snippets) do |instance|
expect(instance).to receive(:execute).with(hard_delete: true).and_call_original
end
expect do
destroy_project(project, user)
......
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