Skip to content

Allow self approvers to be added as merge request approvers but explain why they can't approve

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

In GitLab 11.7 we shipped https://gitlab.com/gitlab-org/gitlab-ee/issues/3845 which prevents commit authors from approving a merge request. This prevent users approving commits they themselves have authored and are being added to the target branch (commits already in the target branch are ignored).

This change is causing some confusion, and it is not obvious what is going on to users who are not aware of the project settings but have permissions to create/edit merge requests.

Proposal

Instead of hiding approvers that are no longer eligible and preventing them from being added, we should allow them to be added but show that are not eligible approvers and won't actually be able to approve.

  • when overriding approval rule and adding approvers
    • search box for approvers will show ineligible approvers in a greyed out state (they can still be added)
    • list of approvers in edit modal will show ineligible approvers in greyed out state (they can be added/removed) like any other
  • when viewing the approval in the merge widget
    • grey out self-approvers and show a tooltip to explain why

Additionally, consider changing the default behavior for new projects to the more permissive allow self-approval, and improving the wording of this configuration option.

Links / references

Original bug report

Summary

This is a very weird problem but we're seeing some user in our organization not being able to add other users as approvers to their merge requests. We have verified the users permissions and groups are correct. One user is an Owner for a repo and for the same MR he can't find some users to add, but when I try it I (as an Owner) can add the same person. I'm unable to to find any existing issues open for this.

I don't really have a workaround that I've found.

Steps to reproduce

User: kazuotani14_shield

MR: https://gitlab.com/shield-ai/general/code/merge_requests/5510 (private)

Attempted to add to approvers list: samkhal, connie.sun

This has been repeatable for him over the last few days. He hasn't tried another repo yet, but I have other users making similar claims on different repos.

When I try to add these two users as approvers to the same MR it works for me (adamjdorwart)

What is the current bug behavior?

Users are unable to add approvers to their MR that have permissions to the repository.

What is the expected correct behavior?

Allows adding approvers.

Relevant logs and/or screenshots

Here is a screen capture showing the user demonstrating that he can add these uses as "assignees" but not as "approvers". This also shows that when the target branch changes so does the behavior function as it should. Both target branches are protected branches. gitlab_mr_approver_fail__1_

Edited by 🤖 GitLab Bot 🤖