egirlskey/packages/backend/src/misc/is-user-related.ts

21 lines
523 B
TypeScript
Raw Normal View History

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
2023-10-04 07:43:24 +00:00
export function isUserRelated(note: any, userIds: Set<string>, ignoreAuthor = false): boolean {
if (userIds.has(note.userId) && !ignoreAuthor) {
return true;
}
2023-10-04 07:48:34 +00:00
if (note.reply != null && note.reply.userId !== note.userId && userIds.has(note.reply.userId)) {
return true;
}
2023-10-04 07:48:34 +00:00
if (note.renote != null && note.renote.userId !== note.userId && userIds.has(note.renote.userId)) {
return true;
}
return false;
}