diff --git a/app/assets/javascripts/projects/settings/branch_rules/components/view/index.vue b/app/assets/javascripts/projects/settings/branch_rules/components/view/index.vue
index cc138ddcaf9523c1fd0038a126a5a927107d51bf..c185b6edb3af3af9f8a7fd07937e6c109d53a3a7 100644
--- a/app/assets/javascripts/projects/settings/branch_rules/components/view/index.vue
+++ b/app/assets/javascripts/projects/settings/branch_rules/components/view/index.vue
@@ -111,17 +111,22 @@ export default {
};
},
update({ project: { branchRules, group } }) {
- const branchRule = branchRules.nodes.find((rule) => rule.name === this.branch);
- this.branchRule = branchRule;
- this.branchProtection = branchRule?.branchProtection;
- this.statusChecks = branchRule?.externalStatusChecks?.nodes || [];
- this.matchingBranchesCount = branchRule?.matchingBranchesCount;
+ const projectBranchRule = branchRules.nodes.find(
+ (rule) => rule.name === this.branch && !rule.branchProtection?.isGroupLevel,
+ );
+
+ this.branchRule = projectBranchRule;
+ this.branchProtection = projectBranchRule?.branchProtection;
+ this.statusChecks = projectBranchRule?.externalStatusChecks?.nodes || [];
+ this.matchingBranchesCount = projectBranchRule?.matchingBranchesCount;
this.groupId = getIdFromGraphQLId(group?.id) || null;
+
if (!this.showApprovers) return;
// The approval rules app uses a separate endpoint to fetch the list of approval rules.
// In future, we will update the GraphQL request to include the approval rules data.
// Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/452330
- const approvalRules = branchRule?.approvalRules?.nodes.map((rule) => rule.name) || [];
+ const approvalRules =
+ projectBranchRule?.approvalRules?.nodes.map((rule) => rule.name) || [];
this.setRulesFilter(approvalRules);
this.fetchRules();
},
@@ -471,7 +476,9 @@ export default {