From 6d290225ef574e8481fe70dedf28eedad32f4acf Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Sun, 22 Oct 2023 19:20:06 +0200 Subject: [PATCH] fix: not checking for renotes during packing of note Closes transfem-org/Sharkey#108 --- .../src/core/entities/NoteEntityService.ts | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index bb9d73580..1453723b2 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -110,16 +110,29 @@ export class NoteEntityService implements OnModuleInit { } else if (packedNote.mentions && packedNote.mentions.some(id => meId === id)) { // 自分へのメンション hide = false; + } else if (packedNote.renote && (meId === packedNote.renote.userId)) { + hide = false; } else { - // フォロワーかどうか - const isFollowing = await this.followingsRepository.exist({ - where: { - followeeId: packedNote.userId, - followerId: meId, - }, - }); + if (packedNote.renote) { + const isFollowing = await this.followingsRepository.exist({ + where: { + followeeId: packedNote.renote.userId, + followerId: meId, + }, + }); + + hide = !isFollowing; + } else { + // フォロワーかどうか + const isFollowing = await this.followingsRepository.exist({ + where: { + followeeId: packedNote.userId, + followerId: meId, + }, + }); - hide = !isFollowing; + hide = !isFollowing; + } } }