From 78e36780be31257a59cb3076ba5402e380ca240f Mon Sep 17 00:00:00 2001 From: Gal Schlezinger Date: Sun, 31 Jan 2016 11:05:47 +0200 Subject: Added '/api/v3/projects/:id/merge_requests/:merge_request_id/closes_issues' route in the API Added some documentation for it Added to changelog Added curl example and an attribute table Moved the api route definition from "lib/api/issues.rb" to "lib/api/merge_requests.rb" Fixed the attributes and changed the documentation to be at "merge_requests.md" too Changed generic titles to more specific titles added an underscore added tests. it depends on a newer version of gitlab-test project I'm doing a since I need to add a branch to the `gitlab-test` repo removed the before using 'iid' instead of 'id' in the description to reference the issues. that makes the tests pass Removed the 'closes-issues' key from test_env. so it should pass the tests Moved the two initializations to the describe block Changed the changelog --- lib/api/merge_requests.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/api/merge_requests.rb') diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index dd7f24f3279..004ff52c1d3 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -300,6 +300,19 @@ module API render_api_error!("Failed to save note #{note.errors.messages}", 400) end end + + # List issues that will close on merge + # + # Parameters: + # id (required) - The ID of a project + # merge_request_id (required) - ID of MR + # Examples: + # GET /projects/:id/merge_requests/:merge_request_id/closes_issues + get "#{path}/closes_issues" do + merge_request = user_project.merge_requests.find(params[:merge_request_id]) + issues = ::Kaminari.paginate_array(merge_request.closes_issues) + present paginate(issues), with: Entities::Issue + end end end end -- cgit v1.2.1