Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRichard Clamp <richardc@unixbeard.net>2017-07-28 19:27:10 +0300
committerRémy Coutable <remy@rymai.me>2017-07-28 19:27:10 +0300
commite77e9b0077bb49aa05a16a3d04690219b2c8205e (patch)
treee2398c069c051fbfe2fdd63fe0fe928968afb444 /lib
parent699a30f06b98445ca630db84cfafba5e0cd320b2 (diff)
Fixup POST /v3/:id/hooks and PUT /v3/:id/hooks/:hook_id
Diffstat (limited to 'lib')
-rw-r--r--lib/api/v3/project_hooks.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/api/v3/project_hooks.rb b/lib/api/v3/project_hooks.rb
index 94614bfc8b6..51014591a93 100644
--- a/lib/api/v3/project_hooks.rb
+++ b/lib/api/v3/project_hooks.rb
@@ -56,7 +56,9 @@ module API
use :project_hook_properties
end
post ":id/hooks" do
- hook = user_project.hooks.new(declared_params(include_missing: false))
+ attrs = declared_params(include_missing: false)
+ attrs[:job_events] = attrs.delete(:build_events) if attrs.key?(:build_events)
+ hook = user_project.hooks.new(attrs)
if hook.save
present hook, with: ::API::V3::Entities::ProjectHook
@@ -77,7 +79,9 @@ module API
put ":id/hooks/:hook_id" do
hook = user_project.hooks.find(params.delete(:hook_id))
- if hook.update_attributes(declared_params(include_missing: false))
+ attrs = declared_params(include_missing: false)
+ attrs[:job_events] = attrs.delete(:build_events) if attrs.key?(:build_events)
+ if hook.update_attributes(attrs)
present hook, with: ::API::V3::Entities::ProjectHook
else
error!("Invalid url given", 422) if hook.errors[:url].present?