diff options
author | Toon Claes <toon@gitlab.com> | 2017-03-27 15:01:45 +0200 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-03-27 15:29:37 +0200 |
commit | add5cd996f2a2261c9897052609a8b9d8a47261a (patch) | |
tree | d033f28ab36cbf0a381b10fe8606220c89127014 /lib/api/helpers.rb | |
parent | d536d9590ba1aa663bd75fc529fb13b0bf164814 (diff) | |
download | gitlab-ce-add5cd996f2a2261c9897052609a8b9d8a47261a.tar.gz |
API: Make the /notes endpoint work with noteable iid instead of id
In API V4 all endpoints were changed so Merge Requests and Issues
should be referred by iid, instead of id. Except the /notes endpoint
was forgotten. So change the endpoints from:
- /projects/:id/issues/:issue_id/notes
- /projects/:id/merge_requests/:merge_request_id/notes
To:
- /projects/:id/issues/:issue_iid/notes
- /projects/:id/merge_requests/:merge_request_iid/notes
For Project Snippets nothing changes.
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index bd22b82476b..61527c1e20b 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -90,6 +90,11 @@ module API MergeRequestsFinder.new(current_user, project_id: user_project.id).find_by!(iid: iid) end + def find_project_snippet(id) + finder_params = { filter: :by_project, project: user_project } + SnippetsFinder.new.execute(current_user, finder_params).find(id) + end + def find_merge_request_with_access(iid, access_level = :read_merge_request) merge_request = user_project.merge_requests.find_by!(iid: iid) authorize! access_level, merge_request |