diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2017-02-25 17:55:32 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2017-03-07 13:06:42 +0530 |
commit | 719327112c2df2d842c4beb993745db1c95950fe (patch) | |
tree | f3df84cf3c1f92e4571ab668096f5742fbe8ead9 /lib/api/v3 | |
parent | dd99622347e639e468b0538ebb57170c1299c858 (diff) | |
download | gitlab-ce-719327112c2df2d842c4beb993745db1c95950fe.tar.gz |
API routes referencing a specific merge request should use the MR `iid`
- As opposed to the `id` that was previously being used.
- This brings the API routes closer to the web interface's routes.
- This is specific to API v4.
Diffstat (limited to 'lib/api/v3')
-rw-r--r-- | lib/api/v3/helpers.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/api/v3/helpers.rb b/lib/api/v3/helpers.rb index 254f8fa6a87..0f234d4cdad 100644 --- a/lib/api/v3/helpers.rb +++ b/lib/api/v3/helpers.rb @@ -4,6 +4,16 @@ module API def find_project_issue(id) IssuesFinder.new(current_user, project_id: user_project.id).find(id) end + + def find_project_merge_request(id) + MergeRequestsFinder.new(current_user, project_id: user_project.id).find(id) + end + + def find_merge_request_with_access(id, access_level = :read_merge_request) + merge_request = user_project.merge_requests.find(id) + authorize! access_level, merge_request + merge_request + end end end end |