CODEOWNERS Approval Shows as Optional when MR Author is Approver and Prevented from Merging
Summary
When:
- "Prevent MR approvals by the author" is checked /
merge_requests_author_approval
=false
- And the Merge Request Author is a member of the
CODEOWNERS
Their CODEOWNERS approval will not load the user avatar and will appear as Optional
(even if required in the CODEOWNERS)
Steps to reproduce
- Create a Project
- Check "Prevent MR approvals by the author" (or leave it at the default nil value - see this bug issue
- Require CODEOWNERS approval for the main or other branch
- Create a CODEOWNERS file requiring approval by a given account for a given file type
- Submit a Merge Request to the main/other branch from that given account containing the given file type
Resulting Approval Settings create some confusion.
Example Project
Here's an example project: https://gitlab.com/gitlab-silver/jayo-codeowners-test/codeowners-test
Example MR: https://gitlab.com/gitlab-silver/jayo-codeowners-test/codeowners-test/-/merge_requests/1
(apologies for the avatar confusion, I used my personal account as the other member, and they have the same avatar)
What is the current bug behavior?
I don't actually think this is an operational bug, but the display is confusing. It seems to make sense that the MR author is filtered out of the Approval Settings - but it becomes confusing with required CODEOWNERS settings.
What is the expected correct behavior?
Less confusing Approval Settings Display
Relevant logs and/or screenshots
Here's the approval JSON in the above project
{
"approval_rules_overwritten": false,
"rules": [
{
"id": 28636464,
"name": "*.txt",
"rule_type": "code_owner",
"approvals_required": 1,
"users": [
{
"id": 5694494,
"name": "Jason Young",
"username": "rambleon",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/14a928fe84529c75e3ccd6933739882e?s=80&d=identicon",
"web_url": "https://gitlab.com/rambleon"
}
],
"groups": [],
"contains_hidden_groups": false,
"section": "text files",
"source_rule": null,
"overridden": false,
"code_owner": true,
"approved_by": [],
"approved": false,
"approvers": [
{
"id": 5694494,
"name": "Jason Young",
"username": "rambleon",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/14a928fe84529c75e3ccd6933739882e?s=80&d=identicon",
"web_url": "https://gitlab.com/rambleon"
}
],
"commented_by": []
},
{
"id": 28636463,
"name": "*.md",
"rule_type": "code_owner",
"approvals_required": 0,
"users": [
{
"id": 3543077,
"name": "Jason Young",
"username": "jayo",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/ad2847a3f399fc5bcb10f0e57911aa58?s=80&d=identicon",
"web_url": "https://gitlab.com/jayo"
}
],
"groups": [],
"contains_hidden_groups": false,
"section": "markdown",
"source_rule": null,
"overridden": false,
"code_owner": true,
"approved_by": [],
"approved": true,
"approvers": [],
"commented_by": []
}
]
}
Output of checks
This bug happens on GitLab.com