From fc3296d64fe74193901916ca74b9e665f3e01bc2 Mon Sep 17 00:00:00 2001 From: naskya Date: Fri, 5 May 2023 05:17:16 +0900 Subject: [PATCH] Fix missing arguments --- packages/backend/src/misc/check-word-mute.ts | 11 +++++++++-- packages/client/src/scripts/check-word-mute.ts | 11 +++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/backend/src/misc/check-word-mute.ts b/packages/backend/src/misc/check-word-mute.ts index 472a2fcbe7..df5348b02c 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 dccbada36b..da44006392 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;