Make non-regex word mutes case insensitive

This commit is contained in:
Laura Hausmann 2023-07-30 17:17:07 +02:00
parent e1481fc8ee
commit 5701946511
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605
2 changed files with 4 additions and 4 deletions

View File

@ -22,7 +22,7 @@ function checkWordMute(
let text = `${note.cw ?? ""} ${note.text ?? ""}`; let text = `${note.cw ?? ""} ${note.text ?? ""}`;
if (note.files != null) if (note.files != null)
text += ` ${note.files.map((f) => f.comment ?? "").join(" ")}`; text += ` ${note.files.map((f) => f.comment ?? "").join(" ")}`;
text = text.trim(); text = text.trim().toLowerCase();
if (text === "") return false; if (text === "") return false;
@ -33,7 +33,7 @@ function checkWordMute(
if ( if (
keywords.length > 0 && keywords.length > 0 &&
keywords.every((keyword) => text.includes(keyword)) keywords.every((keyword) => text.includes(keyword.toLowerCase()))
) )
return true; return true;
} else { } else {

View File

@ -13,7 +13,7 @@ function checkWordMute(
let text = `${note.cw ?? ""} ${note.text ?? ""}`; let text = `${note.cw ?? ""} ${note.text ?? ""}`;
if (note.files != null) if (note.files != null)
text += ` ${note.files.map((f) => f.comment ?? "").join(" ")}`; text += ` ${note.files.map((f) => f.comment ?? "").join(" ")}`;
text = text.trim(); text = text.trim().toLowerCase();
if (text === "") return NotMuted; if (text === "") return NotMuted;
@ -26,7 +26,7 @@ function checkWordMute(
if ( if (
keywords.length > 0 && keywords.length > 0 &&
keywords.every((keyword) => text.includes(keyword)) keywords.every((keyword) => text.includes(keyword.toLowerCase()))
) { ) {
result.muted = true; result.muted = true;
result.matched.push(...keywords); result.matched.push(...keywords);