summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-07-12 17:00:49 -0300
committerFelipe Artur <felipefac@gmail.com>2016-07-19 20:59:00 -0300
commitede048b930b2ceb89013793d878524eb20248d1f (patch)
tree4650debc2eaefa36fef4636efc60cdb60ae47fa5 /app/controllers
parent8bd520d70e035cd67d19b7962911ae9c31d1ff3d (diff)
downloadgitlab-ce-ede048b930b2ceb89013793d878524eb20248d1f.tar.gz
Add project service documentation and update integration documentation
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin/services_controller.rb16
-rw-r--r--app/controllers/concerns/service_params.rb35
-rw-r--r--app/controllers/projects/services_controller.rb17
3 files changed, 38 insertions, 30 deletions
diff --git a/app/controllers/admin/services_controller.rb b/app/controllers/admin/services_controller.rb
index 40938986a92..9d6287f3b61 100644
--- a/app/controllers/admin/services_controller.rb
+++ b/app/controllers/admin/services_controller.rb
@@ -1,4 +1,6 @@
class Admin::ServicesController < Admin::ApplicationController
+ include ServiceParams
+
before_action :service, only: [:edit, :update]
def index
@@ -37,18 +39,4 @@ class Admin::ServicesController < Admin::ApplicationController
def service
@service ||= Service.where(id: params[:id], template: true).first
end
-
- def application_services_params
- dynamic_params = []
- dynamic_params.concat(@service.event_channel_names) if @service.is_a?(SlackService)
-
- application_services_params = params.permit(:id,
- service: Projects::ServicesController::ALLOWED_PARAMS + dynamic_params)
- if application_services_params[:service].is_a?(Hash)
- Projects::ServicesController::FILTER_BLANK_PARAMS.each do |param|
- application_services_params[:service].delete(param) if application_services_params[:service][param].blank?
- end
- end
- application_services_params
- end
end
diff --git a/app/controllers/concerns/service_params.rb b/app/controllers/concerns/service_params.rb
new file mode 100644
index 00000000000..a1c5cd28a27
--- /dev/null
+++ b/app/controllers/concerns/service_params.rb
@@ -0,0 +1,35 @@
+module ServiceParams
+ extend ActiveSupport::Concern
+
+ ALLOWED_PARAMS = [:title, :token, :type, :active, :api_key, :api_url, :api_version, :subdomain,
+ :room, :recipients, :project_url, :webhook,
+ :user_key, :device, :priority, :sound, :bamboo_url, :username, :password,
+ :build_key, :server, :teamcity_url, :drone_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, :build_events, :wiki_page_events,
+ :notify_only_broken_builds, :add_pusher,
+ :send_from_committer_email, :disable_diffs, :external_wiki_url,
+ :notify, :color,
+ :server_host, :server_port, :default_irc_uri, :enable_ssl_verification,
+ :jira_issue_transition_id]
+
+ # Parameters to ignore if no value is specified
+ FILTER_BLANK_PARAMS = [:password]
+
+ def application_services_params
+ dynamic_params = []
+ dynamic_params.concat(@service.event_channel_names)
+
+ application_services_params = params.permit(:id, service: ALLOWED_PARAMS + dynamic_params)
+
+ if application_services_params[:service].is_a?(Hash)
+ FILTER_BLANK_PARAMS.each do |param|
+ application_services_params[:service].delete(param) if application_services_params[:service][param].blank?
+ end
+ end
+
+ application_services_params
+ end
+end
diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb
index 80553e035f0..b0b66a9f599 100644
--- a/app/controllers/projects/services_controller.rb
+++ b/app/controllers/projects/services_controller.rb
@@ -1,20 +1,5 @@
class Projects::ServicesController < Projects::ApplicationController
- ALLOWED_PARAMS = [:title, :token, :type, :active, :api_key, :api_url, :api_version, :subdomain,
- :room, :recipients, :project_url, :webhook,
- :user_key, :device, :priority, :sound, :bamboo_url, :username, :password,
- :build_key, :server, :teamcity_url, :drone_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, :build_events, :wiki_page_events,
- :notify_only_broken_builds, :add_pusher,
- :send_from_committer_email, :disable_diffs, :external_wiki_url,
- :notify, :color,
- :server_host, :server_port, :default_irc_uri, :enable_ssl_verification,
- :jira_issue_transition_id]
-
- # Parameters to ignore if no value is specified
- FILTER_BLANK_PARAMS = [:password]
+ include ServiceParams
# Authorize
before_action :authorize_admin_project!