Commit f99270bf authored by Sean McGivern's avatar Sean McGivern

Merge branch 'services-usage-2' into 'master'

Use `DestroyService` when an admin deletes an SSH Key via the API

See merge request gitlab-org/gitlab!34535
parents b611138a 35e2efd2
---
title: Use Keys::DestroyService for deleting an SSH key when an admin deletes a key via the API
merge_request: 34535
author: Rajendra Kadam
type: fixed
...@@ -306,7 +306,10 @@ module API ...@@ -306,7 +306,10 @@ module API
key = user.keys.find_by(id: params[:key_id]) key = user.keys.find_by(id: params[:key_id])
not_found!('Key') unless key not_found!('Key') unless key
destroy_conditionally!(key) destroy_conditionally!(key) do |key|
destroy_service = ::Keys::DestroyService.new(current_user)
destroy_service.execute(key)
end
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
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