refactor code
This commit is contained in:
parent
82c758c0a8
commit
232bdd47d9
|
@ -19,7 +19,7 @@ class Admin::ApplicationsController < Admin::ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@application = Applications::CreateService.new(current_user, application_params.merge(ip_address: request.remote_ip)).execute
|
||||
@application = Applications::CreateService.new(current_user, application_params.merge.execute(request)
|
||||
|
||||
if @application.persisted?
|
||||
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
|
||||
|
|
|
@ -16,7 +16,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
|
|||
end
|
||||
|
||||
def create
|
||||
@application = Applications::CreateService.new(current_user, create_application_params).execute
|
||||
@application = Applications::CreateService.new(current_user, create_application_params).execute(request)
|
||||
|
||||
if @application.persisted?
|
||||
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
|
||||
|
@ -58,7 +58,6 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
|
|||
def create_application_params
|
||||
application_params.tap do |params|
|
||||
params[:owner] = current_user
|
||||
params[:ip_address] = request.remote_ip
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ module Applications
|
|||
@ip_address = @params.delete(:ip_address)
|
||||
end
|
||||
|
||||
def execute
|
||||
def execute(request = nil)
|
||||
Doorkeeper::Application.create(@params)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue