[go: up one dir, main page]

Skip to content

Add mentions_issues to Merge Request API

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem to solve

Teams tracking issue references within Merge Requests have no programmatic way through the API to retrieve issues mentioned (but not closed by) a merge request.

Intended users

Developers

Further details

Adding an additional end-point shouldn't affect performance of other end-points, and the merge_request model already has the query built.

Proposal

Patch for lib/api/merge_requests.rb

478,489d477
<       get ':id/merge_requests/:merge_request_iid/mentions_issues' do
<         merge_request = find_merge_request_with_access(params[:merge_request_iid])
<         issues = ::Kaminari.paginate_array(merge_request.issues_mentioned_but_not_closing(current_user))
<         issues = paginate(issues)
< 
<         external_issues, internal_issues = issues.partition { |issue| issue.is_a?(ExternalIssue) }
< 
<         data = Entities::IssueBasic.represent(internal_issues, current_user: current_user)
<         data += Entities::ExternalIssue.represent(external_issues, current_user: current_user)
< 
<         data.as_json
<       end

Permissions and Security

No permission changes

Documentation

MR API documentation will need to be updated with new end-point.

Testing

Unknown

What does success look like, and how can we measure that?

Unknown

What is the type of buyer?

Unknown

Links / references

Edited by 🤖 GitLab Bot 🤖