Commit f4adb14c authored by Rajendra Kadam's avatar Rajendra Kadam

Remove initialize method and use base service initialize

parent f08890de
......@@ -2,14 +2,6 @@
module GpgKeys
class CreateService < Keys::BaseService
attr_accessor :current_user
def initialize(current_user, params = {})
@current_user, @params = current_user, params
@ip_address = @params.delete(:ip_address)
@user = params.delete(:user) || current_user
end
def execute
key = user.gpg_keys.create(params)
notification_service.new_gpg_key(key) if key.persisted?
......
......@@ -328,7 +328,7 @@ module API
user = User.find_by(id: params.delete(:id))
not_found!('User') unless user
key = ::GpgKeys::CreateService.new(current_user, declared_params(include_missing: false).merge(user: user)).execute
key = ::GpgKeys::CreateService.new(user, declared_params(include_missing: false)).execute
if key.persisted?
present key, with: Entities::GpgKey
......
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