summaryrefslogtreecommitdiff
path: root/app/controllers/projects/services_controller.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-07-21 18:28:33 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-07-21 18:28:33 +0800
commit83975914337d1dc05193a83d27be577c5631f801 (patch)
treeaeaf2450cb8a8a1c99b064d7d353e28d682c0b65 /app/controllers/projects/services_controller.rb
parente3ce02300bf90451b98479720d1093afe8b7eea8 (diff)
parent4211f50014faebf027fd2bc80e0cf1d3f012627c (diff)
downloadgitlab-ce-83975914337d1dc05193a83d27be577c5631f801.tar.gz
Merge branch 'artifacts-from-ref-and-build-name-api' into artifacts-from-ref-and-build-name
* artifacts-from-ref-and-build-name-api: (384 commits) Add API documentation for downloading the latest successful build Since it's too hard to use JOIN with Rails... feedback: Workaround MySQL with INNER JOIN: Just put setup directly in the test, feedback: Cleanup the use of let, feedback: Lose unneeded instance variables and variables, feedback: Add link to user profile to commit avatar (!5163) It's not longer than 80 chars Make sure there's a build Use the same logic, it should specify that it's not logged in Use 'when logging as guest' for context, feedback: Cleanup that a bit Refactor service settings view Fix a problem with processing a pipeline where stage only has manual actions Rename user2 to reporter_user Should check against `authorize_read_builds!` A CHANGELOG entry Don't show other actions of the same name Use limit parameter rather than hardcoded value Reuse those two methods ...
Diffstat (limited to 'app/controllers/projects/services_controller.rb')
-rw-r--r--app/controllers/projects/services_controller.rb30
1 files changed, 4 insertions, 26 deletions
diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb
index 739681f4085..6a227d85f6f 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!
@@ -33,7 +18,7 @@ class Projects::ServicesController < Projects::ApplicationController
end
def update
- if @service.update_attributes(service_params)
+ if @service.update_attributes(service_params[:service])
redirect_to(
edit_namespace_project_service_path(@project.namespace, @project,
@service.to_param, notice:
@@ -45,8 +30,9 @@ class Projects::ServicesController < Projects::ApplicationController
end
def test
- data = Gitlab::PushDataBuilder.build_sample(project, current_user)
+ data = @service.test_data(project, current_user)
outcome = @service.test(data)
+
if outcome[:success]
message = { notice: 'We sent a request to the provided URL' }
else
@@ -63,12 +49,4 @@ class Projects::ServicesController < Projects::ApplicationController
def service
@service ||= @project.services.find { |service| service.to_param == params[:id] }
end
-
- def service_params
- service_params = params.require(:service).permit(ALLOWED_PARAMS)
- FILTER_BLANK_PARAMS.each do |param|
- service_params.delete(param) if service_params[param].blank?
- end
- service_params
- end
end