Merge pull request #316 from Jonpot/patch-7

Fix triggerMatchTags function to correctly handle 'NOT' operation
This commit is contained in:
Stefan Zermatten
2023-04-14 13:03:53 +02:00
committed by GitHub

View File

@@ -89,23 +89,26 @@ export function triggerMatchTags(trigger, prop) {
matched = true; matched = true;
} }
// Check the extra tags // Check the extra tags
trigger.extraTags?.forEach(extra => { if (trigger.extraTags) {
if (extra.operation === 'OR') { for (const extra of trigger.extraTags) {
if (matched) return; if (extra.operation === 'OR') {
if ( if (matched) break;
!extra.tags.length || if (
difference(extra.tags, propTags).length === 0 !extra.tags.length ||
) { difference(extra.tags, propTags).length === 0
matched = true; ) {
} matched = true;
} else if (extra.operation === 'NOT') { }
if ( } else if (extra.operation === 'NOT') {
extra.tags.length && if (
intersection(extra.tags, propTags) extra.tags.length &&
) { intersection(extra.tags, propTags).length > 0
return false; ) {
matched = false;
break;
}
} }
} }
}); }
return matched; return matched;
} }