From b394328eb139291e8da56d29ffc4d3bdd088f268 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 20 Oct 2023 11:58:09 +0900 Subject: [PATCH] =?UTF-8?q?fix(backend):=20=E3=83=95=E3=82=A9=E3=83=AD?= =?UTF-8?q?=E9=99=90=E3=81=B8=E3=81=AE=E3=83=AA=E3=83=97=E3=81=AE=E3=83=AA?= =?UTF-8?q?=E3=83=97=E5=85=83=E3=81=8C=EF=BC=88=E9=9D=9E=E5=85=AC=E9=96=8B?= =?UTF-8?q?=EF=BC=89=E3=81=AE=E8=A1=A8=E7=A4=BA=E3=81=AE=E3=81=BE=E3=81=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #12083 --- .../backend/src/core/entities/NoteEntityService.ts | 6 ++++-- packages/backend/test/e2e/streaming.ts | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index c100b92ee7..6fde1c3830 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -73,7 +73,7 @@ export class NoteEntityService implements OnModuleInit { @bindThis private async hideNote(packedNote: Packed<'Note'>, meId: MiUser['id'] | null) { - // TODO: isVisibleForMe を使うようにしても良さそう(型違うけど) + // TODO: isVisibleForMe を使うようにしても良さそう(型違うけど) let hide = false; // visibility が specified かつ自分が指定されていなかったら非表示 @@ -83,7 +83,7 @@ export class NoteEntityService implements OnModuleInit { } else if (meId === packedNote.userId) { hide = false; } else { - // 指定されているかどうか + // 指定されているかどうか const specified = packedNote.visibleUserIds!.some((id: any) => meId === id); if (specified) { @@ -360,12 +360,14 @@ export class NoteEntityService implements OnModuleInit { reply: note.replyId ? this.pack(note.reply ?? note.replyId, me, { detail: false, + skipHide: opts.skipHide, withReactionAndUserPairCache: opts.withReactionAndUserPairCache, _hint_: options?._hint_, }) : undefined, renote: note.renoteId ? this.pack(note.renote ?? note.renoteId, me, { detail: true, + skipHide: opts.skipHide, withReactionAndUserPairCache: opts.withReactionAndUserPairCache, _hint_: options?._hint_, }) : undefined, diff --git a/packages/backend/test/e2e/streaming.ts b/packages/backend/test/e2e/streaming.ts index b3b5f1955f..6c40f304f7 100644 --- a/packages/backend/test/e2e/streaming.ts +++ b/packages/backend/test/e2e/streaming.ts @@ -145,6 +145,18 @@ describe('Streaming', () => { assert.strictEqual(fired, true); }); + test('フォローしているユーザーの visibility: followers な投稿への返信が流れる', async () => { + const note = await api('notes/create', { text: 'foo', visibility: 'followers' }, kyoko); + + const fired = await waitFire( + ayano, 'homeTimeline', // ayano:home + () => api('notes/create', { text: 'bar', visibility: 'followers', replyId: note.body.id }, kyoko), // kyoko posts + msg => msg.type === 'note' && msg.body.userId === kyoko.id && msg.body.reply.text === 'foo', + ); + + assert.strictEqual(fired, true); + }); + test('フォローしていないユーザーの投稿は流れない', async () => { const fired = await waitFire( kyoko, 'homeTimeline', // kyoko:home