diff options
author | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-03-21 14:12:52 +0100 |
---|---|---|
committer | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-03-21 16:59:35 +0100 |
commit | 3b088fc5b53f03605484ebef1945b8839abe19de (patch) | |
tree | 1c058f36cf3610449d4636998b59128b5112131c /lib | |
parent | 98fd60f50b6658d21503f548649c8db291050ab7 (diff) | |
download | gitlab-ce-3b088fc5b53f03605484ebef1945b8839abe19de.tar.gz |
Minor improvements on IssuableActions
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/issues.rb | 8 | ||||
-rw-r--r-- | lib/api/merge_requests.rb | 6 |
2 files changed, 4 insertions, 10 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 8c753e9f2ff..e5ae88eb96f 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -199,14 +199,10 @@ module API # Example Request: # DELETE /projects/:id/issues/:issue_id delete ":id/issues/:issue_id" do - issue = user_project.issues.find(params[:issue_id]) - - authorize!(:remove_issue, issue) + issue = user_project.issues.find_by(id: params[:issue_id]) - issue = user_project.issues.find(params[:issue_id]) + authorize!(:destroy_issue, issue) issue.destroy - - present issue, with: Entities::Issue end end end diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index dc94cc5c85f..93052fba06b 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -106,12 +106,10 @@ module API # id (required) - The ID of the project # merge_request_id (required) - The MR id delete ":id/merge_requests/:merge_request_id" do - merge_request = user_project.merge_requests.find(params[:merge_request_id]) + merge_request = user_project.merge_requests.find_by(id: params[:merge_request_id]) - authorize!(:remove_merge_request, merge_request) + authorize!(:destroy_merge_request, merge_request) merge_request.destroy - - present merge_request, with: Entities::MergeRequest end # Routing "merge_request/:merge_request_id/..." is DEPRECATED and WILL BE REMOVED in version 9.0 |