diff options
author | Stan Hu <stanhu@gmail.com> | 2015-04-24 08:33:24 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-04-24 08:33:24 -0700 |
commit | 2f045997516a11622a7c7229ac08ac0d288813df (patch) | |
tree | 8e56883b8cc6bf2f726b99caec7414c05dbe0c84 /app | |
parent | 62117f2f25646009fb5b20d7a215d7d697ce3231 (diff) | |
download | gitlab-ce-2f045997516a11622a7c7229ac08ac0d288813df.tar.gz |
Fix bug where Slack service channel was not saved in admin template settings.
Consolidate allowed parameters in one place to avoid these kinds of bugs in the future.
Closes https://github.com/gitlabhq/gitlabhq/issues/9181
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/services_controller.rb | 11 | ||||
-rw-r--r-- | app/controllers/projects/services_controller.rb | 19 |
2 files changed, 10 insertions, 20 deletions
diff --git a/app/controllers/admin/services_controller.rb b/app/controllers/admin/services_controller.rb index c1fdcd7fab6..a62170662e1 100644 --- a/app/controllers/admin/services_controller.rb +++ b/app/controllers/admin/services_controller.rb @@ -40,15 +40,6 @@ class Admin::ServicesController < Admin::ApplicationController def application_services_params params.permit(:id, - service: [ - :title, :token, :type, :active, :api_key, :subdomain, - :room, :recipients, :project_url, :webhook, - :user_key, :device, :priority, :sound, :bamboo_url, :username, :password, - :build_key, :server, :teamcity_url, :build_type, - :description, :issues_url, :new_issue_url, :restrict_to_branch, - :send_from_committer_email, :disable_diffs, - :push_events, :tag_push_events, :note_events, :issues_events, - :merge_requests_events - ]) + service: Projects::ServicesController::ALLOWED_PARAMS) end end diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb index ae8146dca59..73031851734 100644 --- a/app/controllers/projects/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -1,4 +1,12 @@ class Projects::ServicesController < Projects::ApplicationController + ALLOWED_PARAMS = [:title, :token, :type, :active, :api_key, :subdomain, + :room, :recipients, :project_url, :webhook, + :user_key, :device, :priority, :sound, :bamboo_url, :username, :password, + :build_key, :server, :teamcity_url, :build_type, + :description, :issues_url, :new_issue_url, :restrict_to_branch, :channel, + :colorize_messages, :channels, + :push_events, :issues_events, :merge_requests_events, :tag_push_events, + :note_events, :send_from_committer_email, :disable_diffs, :external_wiki_url] # Authorize before_action :authorize_admin_project! before_action :service, only: [:edit, :update, :test] @@ -45,15 +53,6 @@ class Projects::ServicesController < Projects::ApplicationController end def service_params - params.require(:service).permit( - :title, :token, :type, :active, :api_key, :subdomain, - :room, :recipients, :project_url, :webhook, - :user_key, :device, :priority, :sound, :bamboo_url, :username, :password, - :build_key, :server, :teamcity_url, :build_type, - :description, :issues_url, :new_issue_url, :restrict_to_branch, :channel, - :colorize_messages, :channels, - :push_events, :issues_events, :merge_requests_events, :tag_push_events, - :note_events, :send_from_committer_email, :disable_diffs, :external_wiki_url - ) + params.require(:service).permit(ALLOWED_PARAMS) end end |