When 'self-approval' is enabled no 'explicit approvers' (or not enough users) are set - allow authors to self-approve
This is a follow-up for the discussion initiated on #3349 (closed).
The current behavior of self-approval as documented on https://docs.gitlab.com/ee/user/project/merge_requests/merge_request_approvals.html#allowing-merge-request-authors-to-approve-their-own-merge-requests:
You can allow merge request authors to self-approve merge requests by enabling it at the project level. Authors also need to be included in the approvers list in order to be able to approve their merge request.
Turns out that we saw users that normally don't set approvers explicitly (project or MR settings) raising the following concern:
- No approvers are set on MR or Project (but at least one approve is needed on the MR)
- Self-approval is enabled on project-level settings
- Author (which is maintainer) creates a MR
- Author cannot approve their own MR, but can approve other user MRs (because they're '>= Developer')
The point is that we should evaluate if authors should be able to approve or not their own MR in the scenario above. Given the documented 'Eligible approvers', we currently allow '>= Developer' members to approve, if there's no explicit approvers set, or the number of approvers set is lower than the current number of approvals needed. Therefore, should we also allow authors to self-approve is that scenario?
Update the self-approval behavior to be consistent with the documented eligible approvers behavior.
If self-approval is enabled, and
explicit approvers < required approvals allow all Developers to approve the merge request.