Fix missing arguments
This commit is contained in:
parent
ebfd07628e
commit
fc3296d64f
2 changed files with 16 additions and 6 deletions
|
@ -16,7 +16,10 @@ function escapeRegExp(x: string): string {
|
||||||
return x.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched 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;
|
if (note == null) return false;
|
||||||
|
|
||||||
const text = ((note.cw ?? "") + " " + (note.text ?? "")).trim();
|
const text = ((note.cw ?? "") + " " + (note.text ?? "")).trim();
|
||||||
|
@ -67,7 +70,11 @@ export async function getWordHardMute(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mutedWords.length > 0) {
|
if (mutedWords.length > 0) {
|
||||||
return checkWordMute(note) || checkWordMute(reply) || checkWordMute(renote);
|
return (
|
||||||
|
checkWordMute(note, mutedWords) ||
|
||||||
|
checkWordMute(reply, mutedWords) ||
|
||||||
|
checkWordMute(renote, mutedWords)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -10,7 +10,10 @@ function escapeRegExp(x: string) {
|
||||||
return x.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched 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();
|
const text = ((note.cw ?? "") + " " + (note.text ?? "")).trim();
|
||||||
if (text === "") return NotMuted;
|
if (text === "") return NotMuted;
|
||||||
|
|
||||||
|
@ -57,14 +60,14 @@ export function getWordSoftMute(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mutedWords.length > 0) {
|
if (mutedWords.length > 0) {
|
||||||
let noteMuted = checkWordMute(note);
|
let noteMuted = checkWordMute(note, mutedWords);
|
||||||
if (noteMuted.muted) {
|
if (noteMuted.muted) {
|
||||||
noteMuted.what = "note";
|
noteMuted.what = "note";
|
||||||
return noteMuted;
|
return noteMuted;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.reply) {
|
if (note.reply) {
|
||||||
let replyMuted = checkWordMute(note.reply);
|
let replyMuted = checkWordMute(note.reply, mutedWords);
|
||||||
if (replyMuted.muted) {
|
if (replyMuted.muted) {
|
||||||
replyMuted.what = "reply";
|
replyMuted.what = "reply";
|
||||||
return replyMuted;
|
return replyMuted;
|
||||||
|
@ -72,7 +75,7 @@ export function getWordSoftMute(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.renote) {
|
if (note.renote) {
|
||||||
let renoteMuted = checkWordMute(note.renote);
|
let renoteMuted = checkWordMute(note.renote, mutedWords);
|
||||||
if (renoteMuted.muted) {
|
if (renoteMuted.muted) {
|
||||||
renoteMuted.what = note.text == null ? "renote" : "quote";
|
renoteMuted.what = note.text == null ? "renote" : "quote";
|
||||||
return renoteMuted;
|
return renoteMuted;
|
||||||
|
|
Loading…
Reference in a new issue