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:
authorRémy Coutable <remy@rymai.me>2016-10-19 13:34:31 +0300
committerRémy Coutable <remy@rymai.me>2016-10-19 13:34:31 +0300
commita96756008a634961171e968d76faea68ab2bcb95 (patch)
treea339880a21a4a7354746a4a62f94dfb958d4f2ea /lib
parent72af0e73833f06cfcd10126bc03c688358260e60 (diff)
parent04593581037bca7a7c3b00c719404e610c158cc1 (diff)
Merge branch 'fix-system-hook-api' into 'master'
API: Fix Sytem hooks delete behavior ## What does this MR do? This corrects the delete API for system hooks. Returning 200 is not the right way indicating a hooks is not found. ## What are the relevant issue numbers? Discussed in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6861/diffs#609af00c90e3d5241064d1404e3e018a3235634a_64_62 See merge request !6883
Diffstat (limited to 'lib')
-rw-r--r--lib/api/system_hooks.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/api/system_hooks.rb b/lib/api/system_hooks.rb
index 2e76b91051f..794e34874f4 100644
--- a/lib/api/system_hooks.rb
+++ b/lib/api/system_hooks.rb
@@ -56,12 +56,10 @@ module API
requires :id, type: Integer, desc: 'The ID of the system hook'
end
delete ":id" do
- begin
- hook = SystemHook.find(params[:id])
- present hook.destroy, with: Entities::Hook
- rescue
- # SystemHook raises an Error if no hook with id found
- end
+ hook = SystemHook.find_by(id: params[:id])
+ not_found!('System hook') unless hook
+
+ present hook.destroy, with: Entities::Hook
end
end
end