diff --git a/app/controllers/api/v1/projects_controller.rb b/app/controllers/api/v1/projects_controller.rb index c28b62435..c1a8b1ccf 100644 --- a/app/controllers/api/v1/projects_controller.rb +++ b/app/controllers/api/v1/projects_controller.rb @@ -63,6 +63,13 @@ def update end end + def destroy + super do |resource| + split_display_name = resource.display_name.split('_') + resource.update(display_name: "#{resource.display_name}_deleted") unless split_display_name[split_display_name.length - 1] == 'deleted' + end + end + def create_classifications_export medium = CreateClassificationsExport.with( api_user: api_user, object: controlled_resource ).run!(params) export_medium_response(medium) diff --git a/spec/controllers/api/v1/projects_controller_spec.rb b/spec/controllers/api/v1/projects_controller_spec.rb index 96f6540e8..0a4dd74cd 100644 --- a/spec/controllers/api/v1/projects_controller_spec.rb +++ b/spec/controllers/api/v1/projects_controller_spec.rb @@ -846,6 +846,12 @@ def tag_request let(:instances_to_disable) { [resource] } it_behaves_like 'is deactivatable' + it "appends 'deleted' to display_name" do + stub_token(scopes: scopes, user_id: authorized_user.id) + set_preconditions + delete :destroy, params: { id: resource.id } + expect(resource.reload.display_name).to end_with('deleted') + end end describe '#copy' do