mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 14:07:38 -07:00
Merge pull request 'fix: check alt text on word mutes' (#10149) from naskya/calckey:fix/alt-text-mutes into develop
Reviewed-on: https://codeberg.org/calckey/calckey/pulls/10149
This commit is contained in:
commit
5047898fa6
2 changed files with 7 additions and 2 deletions
|
@ -5,6 +5,7 @@ import type { User } from "@/models/entities/user.js";
|
|||
type NoteLike = {
|
||||
userId: Note["userId"];
|
||||
text: Note["text"];
|
||||
files: Note["files"];
|
||||
cw?: Note["cw"];
|
||||
};
|
||||
|
||||
|
@ -18,7 +19,9 @@ function checkWordMute(
|
|||
): boolean {
|
||||
if (note == null) return false;
|
||||
|
||||
const text = ((note.cw ?? "") + " " + (note.text ?? "")).trim();
|
||||
const text = `${note.cw ?? ""} ${note.text ?? ""} ${note.files
|
||||
.map((f) => f.comment ?? "")
|
||||
.join(" ")}`.trim();
|
||||
if (text === "") return false;
|
||||
|
||||
for (const mutePattern of mutedWords) {
|
||||
|
|
|
@ -10,7 +10,9 @@ function checkWordMute(
|
|||
note: NoteLike,
|
||||
mutedWords: Array<string | string[]>,
|
||||
): Muted {
|
||||
const text = ((note.cw ?? "") + " " + (note.text ?? "")).trim();
|
||||
const text = `${note.cw ?? ""} ${note.text ?? ""} ${note.files
|
||||
.map((f) => f.comment ?? "")
|
||||
.join(" ")}`.trim();
|
||||
if (text === "") return NotMuted;
|
||||
|
||||
let result = { muted: false, matched: [] };
|
||||
|
|
Loading…
Reference in a new issue