diff options
author | Richard Clamp <richardc@unixbeard.net> | 2017-07-28 16:27:10 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-07-28 16:27:10 +0000 |
commit | e77e9b0077bb49aa05a16a3d04690219b2c8205e (patch) | |
tree | e2398c069c051fbfe2fdd63fe0fe928968afb444 /lib/api/v3 | |
parent | 699a30f06b98445ca630db84cfafba5e0cd320b2 (diff) | |
download | gitlab-ce-e77e9b0077bb49aa05a16a3d04690219b2c8205e.tar.gz |
Fixup POST /v3/:id/hooks and PUT /v3/:id/hooks/:hook_id
Diffstat (limited to 'lib/api/v3')
-rw-r--r-- | lib/api/v3/project_hooks.rb | 8 |
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? |