From 34aeeb0862da152b91ea3496c199cf1de631d570 Mon Sep 17 00:00:00 2001 From: Hazel K Date: Tue, 1 Oct 2024 14:44:16 -0400 Subject: [PATCH] respect CWs in note summaries --- packages/backend/src/misc/get-note-summary.ts | 10 ++++++---- packages/frontend/src/scripts/get-note-summary.ts | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/backend/src/misc/get-note-summary.ts b/packages/backend/src/misc/get-note-summary.ts index 1a07139a50..5038106870 100644 --- a/packages/backend/src/misc/get-note-summary.ts +++ b/packages/backend/src/misc/get-note-summary.ts @@ -18,13 +18,15 @@ export const getNoteSummary = (note: Packed<'Note'>): string => { return '(⛔)'; } + if (note.cw != null) { + return `CW: ${note.cw}`; + } + let summary = ''; // 本文 - if (note.cw != null) { - summary += note.cw; - } else { - summary += note.text ? note.text : ''; + 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 6fd9947ac1..85903231a4 100644 --- a/packages/frontend/src/scripts/get-note-summary.ts +++ b/packages/frontend/src/scripts/get-note-summary.ts @@ -23,13 +23,15 @@ 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.cw != null) { - summary += note.cw; - } else { - summary += note.text ? note.text : ''; + if (note.text) { + summary += note.text; } // ファイルが添付されているとき