From 5701946511fb7ca6ceb11f8c3009904fcdab2bdf Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sun, 30 Jul 2023 17:17:07 +0200 Subject: [PATCH] Make non-regex word mutes case insensitive --- packages/backend/src/misc/check-word-mute.ts | 4 ++-- packages/client/src/scripts/check-word-mute.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/misc/check-word-mute.ts b/packages/backend/src/misc/check-word-mute.ts index 8c7d95086..341b3b52f 100644 --- a/packages/backend/src/misc/check-word-mute.ts +++ b/packages/backend/src/misc/check-word-mute.ts @@ -22,7 +22,7 @@ function checkWordMute( let text = `${note.cw ?? ""} ${note.text ?? ""}`; if (note.files != null) text += ` ${note.files.map((f) => f.comment ?? "").join(" ")}`; - text = text.trim(); + text = text.trim().toLowerCase(); if (text === "") return false; @@ -33,7 +33,7 @@ function checkWordMute( if ( keywords.length > 0 && - keywords.every((keyword) => text.includes(keyword)) + keywords.every((keyword) => text.includes(keyword.toLowerCase())) ) return true; } else { diff --git a/packages/client/src/scripts/check-word-mute.ts b/packages/client/src/scripts/check-word-mute.ts index f789d0cd1..b6ae5d1fa 100644 --- a/packages/client/src/scripts/check-word-mute.ts +++ b/packages/client/src/scripts/check-word-mute.ts @@ -13,7 +13,7 @@ function checkWordMute( let text = `${note.cw ?? ""} ${note.text ?? ""}`; if (note.files != null) text += ` ${note.files.map((f) => f.comment ?? "").join(" ")}`; - text = text.trim(); + text = text.trim().toLowerCase(); if (text === "") return NotMuted; @@ -26,7 +26,7 @@ function checkWordMute( if ( keywords.length > 0 && - keywords.every((keyword) => text.includes(keyword)) + keywords.every((keyword) => text.includes(keyword.toLowerCase())) ) { result.muted = true; result.matched.push(...keywords);