Skip to content

Commit

Permalink
3298 edit project display name on delete activated state = inactive (#…
Browse files Browse the repository at this point in the history
…4279)

* implement logic to append deleted to inactive project slug

* fix test

* modifications to code style

* modifications to code style

---------

Co-authored-by: Zach Wolfenbarger <[email protected]>
  • Loading branch information
Tooyosi and zwolf authored Jan 31, 2024
1 parent 873f541 commit db1c680
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/controllers/api/v1/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions spec/controllers/api/v1/projects_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db1c680

Please sign in to comment.