summaryrefslogtreecommitdiff
path: root/lib/api/issues.rb
diff options
context:
space:
mode:
authormhasbini <mohammad.hasbini@gmail.com>2017-04-12 14:38:00 +0300
committermhasbini <mohammad.hasbini@gmail.com>2017-04-12 14:38:00 +0300
commit327e344417888abbbc0811a8068c96c1af6fd326 (patch)
tree0be06b62a72e927f5d2f6b7fda95000454eeca7b /lib/api/issues.rb
parent9c576cc7e9414e64b4aac0544615e7d5e92c3558 (diff)
downloadgitlab-ce-327e344417888abbbc0811a8068c96c1af6fd326.tar.gz
Add issues/:iid/closed_by api endpoint
Diffstat (limited to 'lib/api/issues.rb')
-rw-r--r--lib/api/issues.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb
index 09053e615cb..60b9a89d6a2 100644
--- a/lib/api/issues.rb
+++ b/lib/api/issues.rb
@@ -215,6 +215,21 @@ module API
authorize!(:destroy_issue, issue)
issue.destroy
end
+
+ desc 'List merge requests closing issue' do
+ success Entities::MergeRequestBasic
+ end
+ params do
+ requires :issue_iid, type: Integer, desc: 'The internal ID of a project issue'
+ end
+ get ':id/issues/:issue_iid/closed_by' do
+ issue = find_project_issue(params[:issue_iid])
+
+ merge_request_ids = MergeRequestsClosingIssues.where(issue_id: issue).select(:merge_request_id)
+ merge_requests = MergeRequestsFinder.new(current_user, project_id: user_project.id).execute.where(id: merge_request_ids)
+
+ present paginate(merge_requests), with: Entities::MergeRequestBasic, current_user: current_user, project: user_project
+ end
end
end
end