Commit e10a91fe authored by Sean McGivern's avatar Sean McGivern

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

Use GpgKeys::CreateService when a user creates gpg keys for themselves via the API

See merge request gitlab-org/gitlab!34817
parents ebe097ab 8de26906
---
title: Use GpgKeys::CreateService when a user creates GPG keys for themselves via the API
merge_request: 34817
author: Rajendra Kadam
type: fixed
......@@ -792,9 +792,9 @@ module API
requires :key, type: String, desc: 'The new GPG key'
end
post 'gpg_keys' do
key = current_user.gpg_keys.new(declared_params)
key = ::GpgKeys::CreateService.new(current_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