1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-23 17:02:25 +03:00

fix tests

This commit is contained in:
Michael Telatynski
2021-06-15 10:15:43 +01:00
parent e0c36498e6
commit eb5908d5d2

View File

@@ -102,25 +102,20 @@ export class FilterComponent {
const name = Object.keys(literalKeys)[n]; const name = Object.keys(literalKeys)[n];
const matchFunc = literalKeys[name]; const matchFunc = literalKeys[name];
const notName = "not_" + name; const notName = "not_" + name;
const disallowedValues = this[notName]; const disallowedValues: string[] = this.filterJson[notName];
if (disallowedValues.filter(matchFunc).length > 0) { if (disallowedValues?.some(matchFunc)) {
return false; return false;
} }
const allowedValues = this[name]; const allowedValues: string[] = this.filterJson[name];
if (allowedValues && allowedValues.length > 0) { if (allowedValues && !allowedValues.some(matchFunc)) {
const anyMatch = allowedValues.some(matchFunc); return false;
if (!anyMatch) {
return false;
}
} }
} }
const containsUrlFilter = this.filterJson.contains_url; const containsUrlFilter = this.filterJson.contains_url;
if (containsUrlFilter !== undefined) { if (containsUrlFilter !== undefined && containsUrlFilter !== containsUrl) {
if (containsUrlFilter !== containsUrl) { return false;
return false;
}
} }
return true; return true;