Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3298 edit project display name on delete activated state = inactive #4279

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading