mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-11-25 07:36:18 +09:00
Fix missing arguments
This commit is contained in:
parent
4e60fa7193
commit
f023992ab0
@ -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<string | string[]>,
|
||||
): 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;
|
||||
|
@ -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<string | string[]>,
|
||||
): 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;
|
||||
|
Loading…
Reference in New Issue
Block a user