polish matchesAllTags (#190777)

* polish matchesAllTags

* Even more polish
This commit is contained in:
Raymond Zhao 2023-08-21 08:06:56 -07:00 committed by GitHub
parent 5d0b606ec4
commit c90b977571
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -382,7 +382,9 @@ export class SettingsTreeSettingElement extends SettingsTreeElement {
}
matchesAllTags(tagFilters?: Set<string>): boolean {
if (!tagFilters || !tagFilters.size) {
if (!tagFilters?.size) {
// This setting, which may have tags,
// matches against a query with no tags.
return true;
}
@ -392,15 +394,9 @@ export class SettingsTreeSettingElement extends SettingsTreeElement {
this.inspectSelf();
}
if (this.tags) {
let hasFilteredTag = true;
tagFilters.forEach(tag => {
hasFilteredTag = hasFilteredTag && this.tags!.has(tag);
});
return hasFilteredTag;
} else {
return false;
}
// Check that the filter tags are a subset of this setting's tags
return !!this.tags?.size &&
Array.from(tagFilters).every(tag => this.tags!.has(tag));
}
matchesScope(scope: SettingsTarget, isRemote: boolean): boolean {