Commit c8eef9e1 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'zeitwerk-gpg-key-inflection' into 'master'

Fix inconsistent inflection of GpgKey module

See merge request gitlab-org/gitlab!26632
parents b4616617 6b307f25
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
module Entities module Entities
class GPGKey < Grape::Entity class GpgKey < Grape::Entity
expose :id, :key, :created_at expose :id, :key, :created_at
end end
end end
......
...@@ -308,7 +308,7 @@ module API ...@@ -308,7 +308,7 @@ module API
desc 'Add a GPG key to a specified user. Available only for admins.' do desc 'Add a GPG key to a specified user. Available only for admins.' do
detail 'This feature was added in GitLab 10.0' detail 'This feature was added in GitLab 10.0'
success Entities::GPGKey success Entities::GpgKey
end end
params do params do
requires :id, type: Integer, desc: 'The ID of the user' requires :id, type: Integer, desc: 'The ID of the user'
...@@ -324,7 +324,7 @@ module API ...@@ -324,7 +324,7 @@ module API
key = user.gpg_keys.new(declared_params(include_missing: false)) key = user.gpg_keys.new(declared_params(include_missing: false))
if key.save if key.save
present key, with: Entities::GPGKey present key, with: Entities::GpgKey
else else
render_validation_error!(key) render_validation_error!(key)
end end
...@@ -333,7 +333,7 @@ module API ...@@ -333,7 +333,7 @@ module API
desc 'Get the GPG keys of a specified user. Available only for admins.' do desc 'Get the GPG keys of a specified user. Available only for admins.' do
detail 'This feature was added in GitLab 10.0' detail 'This feature was added in GitLab 10.0'
success Entities::GPGKey success Entities::GpgKey
end end
params do params do
requires :id, type: Integer, desc: 'The ID of the user' requires :id, type: Integer, desc: 'The ID of the user'
...@@ -346,7 +346,7 @@ module API ...@@ -346,7 +346,7 @@ module API
user = User.find_by(id: params[:id]) user = User.find_by(id: params[:id])
not_found!('User') unless user not_found!('User') unless user
present paginate(user.gpg_keys), with: Entities::GPGKey present paginate(user.gpg_keys), with: Entities::GpgKey
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
...@@ -746,18 +746,18 @@ module API ...@@ -746,18 +746,18 @@ module API
desc "Get the currently authenticated user's GPG keys" do desc "Get the currently authenticated user's GPG keys" do
detail 'This feature was added in GitLab 10.0' detail 'This feature was added in GitLab 10.0'
success Entities::GPGKey success Entities::GpgKey
end end
params do params do
use :pagination use :pagination
end end
get 'gpg_keys' do get 'gpg_keys' do
present paginate(current_user.gpg_keys), with: Entities::GPGKey present paginate(current_user.gpg_keys), with: Entities::GpgKey
end end
desc 'Get a single GPG key owned by currently authenticated user' do desc 'Get a single GPG key owned by currently authenticated user' do
detail 'This feature was added in GitLab 10.0' detail 'This feature was added in GitLab 10.0'
success Entities::GPGKey success Entities::GpgKey
end end
params do params do
requires :key_id, type: Integer, desc: 'The ID of the GPG key' requires :key_id, type: Integer, desc: 'The ID of the GPG key'
...@@ -767,13 +767,13 @@ module API ...@@ -767,13 +767,13 @@ module API
key = current_user.gpg_keys.find_by(id: params[:key_id]) key = current_user.gpg_keys.find_by(id: params[:key_id])
not_found!('GPG Key') unless key not_found!('GPG Key') unless key
present key, with: Entities::GPGKey present key, with: Entities::GpgKey
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
desc 'Add a new GPG key to the currently authenticated user' do desc 'Add a new GPG key to the currently authenticated user' do
detail 'This feature was added in GitLab 10.0' detail 'This feature was added in GitLab 10.0'
success Entities::GPGKey success Entities::GpgKey
end end
params do params do
requires :key, type: String, desc: 'The new GPG key' requires :key, type: String, desc: 'The new GPG key'
...@@ -782,7 +782,7 @@ module API ...@@ -782,7 +782,7 @@ module API
key = current_user.gpg_keys.new(declared_params) key = current_user.gpg_keys.new(declared_params)
if key.save if key.save
present key, with: Entities::GPGKey present key, with: Entities::GpgKey
else else
render_validation_error!(key) render_validation_error!(key)
end end
......
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