mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 14:07:38 -07:00
clean up
This commit is contained in:
parent
2297f1c57f
commit
c99badde3e
1 changed files with 3 additions and 7 deletions
|
@ -12,10 +12,6 @@ type UserLike = {
|
||||||
id: User["id"];
|
id: User["id"];
|
||||||
};
|
};
|
||||||
|
|
||||||
function escapeRegExp(x: string): string {
|
|
||||||
return x.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkWordMute(
|
function checkWordMute(
|
||||||
note: NoteLike,
|
note: NoteLike,
|
||||||
mutedWords: Array<string | string[]>,
|
mutedWords: Array<string | string[]>,
|
||||||
|
@ -34,7 +30,7 @@ function checkWordMute(
|
||||||
|
|
||||||
// This should never happen due to input sanitisation.
|
// This should never happen due to input sanitisation.
|
||||||
if (!regexp) {
|
if (!regexp) {
|
||||||
console.warn(`Found invalid regex in word mutes: ${mutePattern}`);
|
console.warn(`Found invalid regex in word mutes: ${filter}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,8 +59,8 @@ export async function getWordHardMute(
|
||||||
if (mutedWords.length > 0) {
|
if (mutedWords.length > 0) {
|
||||||
return (
|
return (
|
||||||
checkWordMute(note, mutedWords) ||
|
checkWordMute(note, mutedWords) ||
|
||||||
checkWordMute(reply, mutedWords) ||
|
checkWordMute(note.reply, mutedWords) ||
|
||||||
checkWordMute(renote, mutedWords)
|
checkWordMute(note.renote, mutedWords)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue