Commit ebe097ab authored by Sean McGivern's avatar Sean McGivern

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

Use `GpgKeys::CreateService` when an admin creates a new gpg key for a user

See merge request gitlab-org/gitlab!34737
parents 14aae568 f75943cd
---
title: Use GpgKeys::CreateService when an admin creates a new GPG key for a user
merge_request: 34737
author: Rajendra Kadam
type: fixed
......@@ -328,9 +328,9 @@ module API
user = User.find_by(id: params.delete(:id))
not_found!('User') unless user
key = user.gpg_keys.new(declared_params(include_missing: false))
key = ::GpgKeys::CreateService.new(user, declared_params(include_missing: false)).execute
if key.save
if key.persisted?
present key, with: Entities::GpgKey
else
render_validation_error!(key)
......
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