From 37aaeb8093fbde5127aa6658e8856a77ddd42ef8 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sun, 23 Jul 2023 12:57:53 +0200 Subject: [PATCH] Fix reply visibility errors --- .../backend/src/models/repositories/note.ts | 20 ++++++++++++++++++- .../src/components/MkSubNoteContent.vue | 18 +++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/models/repositories/note.ts b/packages/backend/src/models/repositories/note.ts index 453179bd6..ecd5ead6d 100644 --- a/packages/backend/src/models/repositories/note.ts +++ b/packages/backend/src/models/repositories/note.ts @@ -246,7 +246,7 @@ export const NoteRepository = db.getRepository(Note).extend({ ...(opts.detail ? { reply: note.replyId - ? this.pack(note.reply || note.replyId, me, { + ? this.tryPack(note.reply || note.replyId, me, { detail: false, _hint_: options?._hint_, }) @@ -283,6 +283,24 @@ export const NoteRepository = db.getRepository(Note).extend({ return packed; }, + async tryPack( + src: Note["id"] | Note, + me?: { id: User["id"] } | null | undefined, + options?: { + detail?: boolean; + _hint_?: { + myReactions: Map; + }; + }, + ): Promise | undefined> { + try { + return await this.pack(src, me, options); + } + catch { + return undefined; + } + }, + async packMany( notes: Note[], me?: { id: User["id"] } | null | undefined, diff --git a/packages/client/src/components/MkSubNoteContent.vue b/packages/client/src/components/MkSubNoteContent.vue index fbc92a949..8206a5f18 100644 --- a/packages/client/src/components/MkSubNoteContent.vue +++ b/packages/client/src/components/MkSubNoteContent.vue @@ -25,6 +25,15 @@ > + + + + + +