Branch-scoped approval rules not working in Create MR form
Summary
To address the discussion in !22749 (comment 275459591).
#460 (closed) adds the ability to scope project-level approval rules to specific protected branches. So if the target branch of the merge request matches the scope set for an approval rule, that approval rule is applied.
But there's currently a bug when creating a merge request with source branch A
and target branch B
: all project-level approval rules are show in the create form, even if none of them matches branches A
or B
. Upon creation, they are no longer shown in the MR or in its edit form. This effectively makes it look like the branch-scoped approval rules feature is not working.
Steps to reproduce
- Protect branch
C
- Add a project-level approval rule that is scoped to branch
C
- Create a merge request from branch
A
to branchB
What is the current bug behavior?
All project-level approval rules are show in the create merge request form, even if they don't match the target branch. When viewing the merge request or editing it, the approval rules are correct.
What is the expected correct behavior?
Only the approval rules that match the target branch should appear in the create merge request form.