Skip to content

Filter out group-level rules from details page

What does this MR do and why?

We've partially implemented Phase 2: Improve UX for group-level rules from Fix "View details" functionality for branch rul... (#569901 - closed) with group level indicators on the branch rules list view in Remove messaging regarding protected branches (#538383 - closed). But since there hasn't been any backend change, we still run into an issue where the group level rule is displayed on the branch rule's details page. It's properly labelled as a group level, but there's also no way to display that page for the project level rule instead. This edge case happens only when the protections on both level target the same branch name pattern/branch name. To solve this without big backend changes this MR:

  • filters out branch rules by isGroupLevel value, so that only project level rules are displayed under http://gdk.test:8080/flightjs/Flight/-/settings/repository#branch-rules details view
  • shows empty state for group level branches, in case someone enters by the url (going via UI from branch rules list is not possible at the moment, as we show group level indicator, disable the link to project level and give group level settings link instead)

References

Screenshots or screen recordings

Context Before After
*-test rule available on both levels and details page for it Screenshot_2025-10-14_at_15.00.10 Screenshot_2025-10-14_at_12.11.58 Screenshot_2025-10-14_at_15.00.10 Screenshot_2025-10-14_at_15.00.27
branch protected on group level where there is no project level protecton for the same target Screenshot_2025-10-14_at_15.04.40 Screenshot_2025-10-14_at_14.59.59

How to set up and validate locally

  1. Go to the group. Navigate to Settings / Repository / Protected branches. Example: http://gdk.test:8080/groups/flightjs/-/settings/repository#js-protected-branches-settings
  2. Set a group level protected branch. For example, for *-group-level wildcard.
  3. Go to a project within that group. Navigate to Settings / Repository / Branch rules / [YOUR_GROUP_LEVEL_PROTECTED_BRANCH]. For example: http://gdk.test:8080/flightjs/Flight/-/settings/repository/branch_rules?branch=*-group-level You should see an empty state.
  4. Go to the group. Navigate to Settings / Repository / Protected branches. Example: http://gdk.test:8080/groups/flightjs/-/settings/repository#js-protected-branches-settings and create another protected branch. For example test-*. Make sure to add specific protections, so it's easier to distinguish it later
    1. Go to a project within that group. Navigate to Settings / Repository / Branch rules and create a branch rule for the same target branch (in our example test-*).
  5. Verify that after the redirect to branch rule's details page you see default values for branch protection, not the ones that you set on the group level.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Paulina Sedlak-Jakubowska

Merge request reports

Loading