diff --git a/packages/backend/src/misc/check-word-mute.ts b/packages/backend/src/misc/check-word-mute.ts index 472a2fcbe..df5348b02 100644 --- a/packages/backend/src/misc/check-word-mute.ts +++ b/packages/backend/src/misc/check-word-mute.ts @@ -16,7 +16,10 @@ function escapeRegExp(x: string): string { return x.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string } -function checkWordMute(note: NoteLike): boolean { +function checkWordMute( + note: NoteLike, + mutedWords: Array, +): boolean { if (note == null) return false; const text = ((note.cw ?? "") + " " + (note.text ?? "")).trim(); @@ -67,7 +70,11 @@ export async function getWordHardMute( } if (mutedWords.length > 0) { - return checkWordMute(note) || checkWordMute(reply) || checkWordMute(renote); + return ( + checkWordMute(note, mutedWords) || + checkWordMute(reply, mutedWords) || + checkWordMute(renote, mutedWords) + ); } return false; diff --git a/packages/client/src/scripts/check-word-mute.ts b/packages/client/src/scripts/check-word-mute.ts index dccbada36..da4400639 100644 --- a/packages/client/src/scripts/check-word-mute.ts +++ b/packages/client/src/scripts/check-word-mute.ts @@ -10,7 +10,10 @@ function escapeRegExp(x: string) { return x.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string } -function checkWordMute(note: NoteLike): Muted { +function checkWordMute( + note: NoteLike, + mutedWords: Array, +): Muted { const text = ((note.cw ?? "") + " " + (note.text ?? "")).trim(); if (text === "") return NotMuted; @@ -57,14 +60,14 @@ export function getWordSoftMute( } if (mutedWords.length > 0) { - let noteMuted = checkWordMute(note); + let noteMuted = checkWordMute(note, mutedWords); if (noteMuted.muted) { noteMuted.what = "note"; return noteMuted; } if (note.reply) { - let replyMuted = checkWordMute(note.reply); + let replyMuted = checkWordMute(note.reply, mutedWords); if (replyMuted.muted) { replyMuted.what = "reply"; return replyMuted; @@ -72,7 +75,7 @@ export function getWordSoftMute( } if (note.renote) { - let renoteMuted = checkWordMute(note.renote); + let renoteMuted = checkWordMute(note.renote, mutedWords); if (renoteMuted.muted) { renoteMuted.what = note.text == null ? "renote" : "quote"; return renoteMuted;