Fix policy scope display for inherited scoped policies
What does this MR do and why?
This MR fixes a bug where inherited group policies that are scoped to specific projects incorrectly display "This project" in the scope column when viewed from a project they are not scoped to.
Current behavior: Group-level policies scoped to specific projects show "This project" in all child projects, even those not in the policy scope.
Expected behavior: Group-level policies scoped to specific projects should show "Not scoped to this project" when viewed from projects outside their scope.
Screenshots or screen recordings
Before
Shows "This project" even though the policy is not scoped to this project.
After
Will show "Not scoped to this project" for inherited policies with a scope that doesn't include the current project.
How to set up and validate locally
- Upload a GitLab Ultimate license
- Navigate to a group with multiple projects => Secure => Policies => New policy
- Create a policy of any type and scope it to one specific child project
- Navigate to a different project in the group (one that the policy was NOT scoped to) => Secure => Policies
- Verify the inherited policy now shows "Not scoped to this project" instead of "This project"
MR acceptance checklist
-
Frontend-only change -
Maintains existing behavior for non-inherited policies -
Maintains existing behavior for inherited policies in default mode -
Adds new text for inherited scoped policies not applying to current project
Closes #579772
