iceshrimp-161sh/packages/backend/src/misc/is-user-related.ts

8 lines
444 B
TypeScript
Raw Normal View History

export function isUserRelated(note: any, ids: Set<string>): boolean {
2022-07-27 08:12:15 +02:00
if (ids.has(note.userId)) return true; // note author is muted
2023-01-16 20:19:20 +01:00
if (note.mentions?.some((user: string) => ids.has(user))) return true; // any of mentioned users are muted
2023-01-13 05:40:33 +01:00
if (note.reply && isUserRelated(note.reply, ids)) return true; // also check reply target
2022-07-27 08:12:15 +02:00
if (note.renote && isUserRelated(note.renote, ids)) return true; // also check renote target
return false;
}