diff --git a/packages/backend/src/misc/is-user-related.ts b/packages/backend/src/misc/is-user-related.ts index e6bbdb5d35..a1811c3ce3 100644 --- a/packages/backend/src/misc/is-user-related.ts +++ b/packages/backend/src/misc/is-user-related.ts @@ -1,15 +1,7 @@ -export function isUserRelated(note: any, userIds: Set): boolean { - if (userIds.has(note.userId)) { - return true; - } - - if (note.reply != null && userIds.has(note.reply.userId)) { - return true; - } - - if (note.renote != null && userIds.has(note.renote.userId)) { - return true; - } - +export function isUserRelated(note: any, ids: Set): boolean { + if(ids.has(note.userId)) return true; // note author is muted + if(note.mentions && note.mentions.some((user: string) => ids.has(user))) return true; // any of mentioned users are muted + if(note.reply && isUserRelated(note.reply, ids)) return true; // also check reply target + if(note.renote && isUserRelated(note.renote, ids)) return true; // also check renote target return false; }