diff options
author | rpereira2 <rpereira@gitlab.com> | 2019-02-05 11:57:12 +0530 |
---|---|---|
committer | rpereira2 <rpereira@gitlab.com> | 2019-02-07 10:37:07 +0530 |
commit | 12bb2f8bb46798da72dda5e2e176dba4076cb219 (patch) | |
tree | 223e87047754beae18997513b84b838afab1ca56 | |
parent | cffd30afa137bc378e59423b2a3f9e99d8dcf891 (diff) | |
download | gitlab-ce-12bb2f8bb46798da72dda5e2e176dba4076cb219.tar.gz |
Move render code into functions
This will make it easier to override in EE.
-rw-r--r-- | app/controllers/projects/settings/operations_controller.rb | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/app/controllers/projects/settings/operations_controller.rb b/app/controllers/projects/settings/operations_controller.rb index 0b5ffd0b18c..b8c0aaf9339 100644 --- a/app/controllers/projects/settings/operations_controller.rb +++ b/app/controllers/projects/settings/operations_controller.rb @@ -14,24 +14,33 @@ module Projects def update result = ::Projects::Operations::UpdateService.new(project, current_user, update_params).execute + render_update_response(result) + end + + private + + # overridden in EE + def render_update_response(result) respond_to do |format| format.json do - if result[:status] == :success - render json: - result.slice(:status).merge({ - message: _('Your changes have been saved') - }) - else - render( - status: result[:http_status] || :bad_request, - json: result.slice(:status, :message) - ) - end + render_update_json_response(result) end end end - private + def render_update_json_response(result) + if result[:status] == :success + render json: + result.slice(:status).merge({ + message: _('Your changes have been saved') + }) + else + render( + status: result[:http_status] || :bad_request, + json: result.slice(:status, :message) + ) + end + end def error_tracking_setting @error_tracking_setting ||= project.error_tracking_setting || |