From 236eed94bb970d5ca69a6009fb9459a4ba69bb48 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 3 Oct 2023 10:28:01 +0900 Subject: [PATCH] wip --- packages/backend/src/core/entities/NoteEntityService.ts | 6 +++--- packages/backend/src/server/api/endpoints/notes/timeline.ts | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index a024286b48..cf0abd9174 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -98,13 +98,13 @@ export class NoteEntityService implements OnModuleInit { } else if (meId === packedNote.userId) { hide = false; } else if (packedNote.reply && (meId === packedNote.reply.userId)) { - // 自分の投稿に対するリプライ + // 自分の投稿に対するリプライ hide = false; } else if (packedNote.mentions && packedNote.mentions.some(id => meId === id)) { - // 自分へのメンション + // 自分へのメンション hide = false; } else { - // フォロワーかどうか + // フォロワーかどうか const isFollowing = await this.followingsRepository.exist({ where: { followeeId: packedNote.userId, diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts index 62274e83f6..2f25d2d7ce 100644 --- a/packages/backend/src/server/api/endpoints/notes/timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts @@ -65,10 +65,12 @@ export default class extends Endpoint { // eslint- ) { super(meta, paramDef, async (ps, me) => { const [ + followings, userIdsWhoMeMuting, userIdsWhoMeMutingRenotes, userIdsWhoBlockingMe, ] = await Promise.all([ + this.cacheService.userFollowingsCache.fetch(me.id), this.cacheService.userMutingsCache.fetch(me.id), this.cacheService.renoteMutingsCache.fetch(me.id), this.cacheService.userBlockedCache.fetch(me.id), @@ -116,6 +118,9 @@ export default class extends Endpoint { // eslint- if (ps.withRenotes === false) return false; } } + if (note.reply && note.reply.visibility === 'followers') { + if (!Object.hasOwn(followings, note.reply.userId)) return false; + } return true; });