Make the Merge Request Review (Batch Comments) Feature available via the API
Release notes
In order to keep the e-mails developers received upon automatically created merge request comments at a minimum, it would be great if draft discussions (part of the batch comment feature of reviews) could also be created via the API.
Problem to solve
As written above, make the merge request drafts/review feature available via the Rest API v4.
User experience goal
The user will not get one email per automatically created discussion but only one overall, which reduces spam and increases developer acceptance for automatically created discussions.
Proposal
A simple solution would be to just provide the same endpoint the GitLab UI is using ($base_url/$project_part/-/merge_requests/$mr_iid/drafts
) via the API, e.g. at $base_url/api/v4/projects/$project_id/merge_requests/$mr_id/drafts
.
Alternativly the same Endpoint could also just be allowed to be used via the existing access tokens with "api" rights. But I would consider this a rather hacky solution.
Further details
For us this issue comes up with automated code quality checks with Sonarqube. At the beginning there can be a vast amount of issues, and the Sonarqube-GitLab integration is creating one discussion per issue. In the extreme cases in the past this lead to over 100 emails sent to each participant of the merge request.
We consider it important to know about the issues and interacting with them by resolving discussions in GitLab is a great way of keeping track of the current situation, but the sheer amount of e-mails lets the developer acceptance drop quite a bit.
Permissions and Security
Same permissions as for any other api call.
Documentation
GitLab API Documentation should be updated, either here: https://docs.gitlab.com/ee/api/merge_requests.html or in a new page for drafts
Availability & Testing
This feature is completely backwards compatible and only opens up a new way to interact with the GitLab Rest API.
Additional tests to be added to: https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/requests/api/merge_requests_spec.rb
Available Tier
Free
What does success look like, and how can we measure that?
Merge Request Draft Discussions are available via the REST API v4.