diff options
author | James Lopez <james@jameslopez.es> | 2017-10-31 09:02:57 +0100 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-10-31 09:03:59 +0100 |
commit | 232bdd47d9af004b09cfde68d866d3e694572774 (patch) | |
tree | b4ea227a265c6515ea6db29e08c480ed95bfcf3b /app | |
parent | 82c758c0a85433ca05442ed440f823e17e82573b (diff) | |
download | gitlab-ce-232bdd47d9af004b09cfde68d866d3e694572774.tar.gz |
refactor code
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/applications_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/oauth/applications_controller.rb | 3 | ||||
-rw-r--r-- | app/services/applications/create_service.rb | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/app/controllers/admin/applications_controller.rb b/app/controllers/admin/applications_controller.rb index 69ebe7db08b..bf4e65183ad 100644 --- a/app/controllers/admin/applications_controller.rb +++ b/app/controllers/admin/applications_controller.rb @@ -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]) diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb index 4dbd61bfeae..2443f529c7b 100644 --- a/app/controllers/oauth/applications_controller.rb +++ b/app/controllers/oauth/applications_controller.rb @@ -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 diff --git a/app/services/applications/create_service.rb b/app/services/applications/create_service.rb index ccc0d0848f9..35d45f25a71 100644 --- a/app/services/applications/create_service.rb +++ b/app/services/applications/create_service.rb @@ -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 |