[ACA-4644] Inherited & linked rules that are disabled should not be listed (#2843)

* [ACA-4644] Inherited & linked rules that are disabled should not be listed

* Added condition for linked rule sets to need only enabled rules

* Added a bypass for the empty rules list for linked rule sets that have only disabled rules

* Replaced array filter with some
This commit is contained in:
Thomas Hunter
2022-12-13 10:10:17 +00:00
committed by GitHub
parent 49f0cc3b61
commit 8c7c40a3d4
9 changed files with 101 additions and 27 deletions

View File

@@ -143,7 +143,10 @@ export class FolderRuleSetsService {
this.mainRuleSetSource.next(mainRuleSet);
this.inheritedRuleSetsSource.next(inheritedRuleSets);
this.hasMoreRuleSetsSource.next(this.hasMoreRuleSets);
this.folderRulesService.selectRule(mainRuleSet?.rules[0] ?? inheritedRuleSets[0]?.rules[0] ?? null);
const ruleToSelect =
mainRuleSet?.rules.find((r: Rule) => FolderRuleSetsService.isOwnedRuleSet(mainRuleSet, nodeId) || r.isEnabled) ??
inheritedRuleSets.reduce((foundRule: Rule, ruleSet: RuleSet) => foundRule ?? ruleSet.rules.find((r: Rule) => r.isEnabled), null);
this.folderRulesService.selectRule(ruleToSelect);
});
}