From cb10fe91bb425f5e01e9c884fff824dea269705a Mon Sep 17 00:00:00 2001 From: Hazel K Date: Tue, 1 Oct 2024 18:26:59 -0400 Subject: [PATCH] preserve non-text details in note summaries --- packages/backend/src/misc/get-note-summary.ts | 8 +++----- packages/frontend/src/scripts/get-note-summary.ts | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/backend/src/misc/get-note-summary.ts b/packages/backend/src/misc/get-note-summary.ts index 58938d3b32..2652294103 100644 --- a/packages/backend/src/misc/get-note-summary.ts +++ b/packages/backend/src/misc/get-note-summary.ts @@ -18,14 +18,12 @@ export const getNoteSummary = (note: Packed<'Note'>): string => { return '(⛔)'; } - if (note.cw != null) { - return `CW: ${note.cw}`; - } - let summary = ''; // 本文 - if (note.text) { + if (note.cw != null) { + summary += `CW: ${note.cw}`; + } else if (note.text) { summary += note.text; } diff --git a/packages/frontend/src/scripts/get-note-summary.ts b/packages/frontend/src/scripts/get-note-summary.ts index d695b3a062..6c70ced67f 100644 --- a/packages/frontend/src/scripts/get-note-summary.ts +++ b/packages/frontend/src/scripts/get-note-summary.ts @@ -23,14 +23,12 @@ export const getNoteSummary = (note?: Misskey.entities.Note | null): string => { return `(${i18n.ts.invisibleNote})`; } - if (note.cw != null) { - return `CW: ${note.cw}`; - } - let summary = ''; // 本文 - if (note.text) { + if (note.cw != null) { + summary += `CW: ${note.cw}`; + } else if (note.text) { summary += note.text; }