From 84ffc6361bc39c0beff6403618081502f3397ba3 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Fri, 12 Sep 2025 14:07:43 -0400 Subject: [PATCH] fix duplicate mandatory CWs in following feed --- .../src/components/SkFollowingFeedEntry.vue | 2 +- .../frontend/src/utility/get-note-summary.ts | 23 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/frontend/src/components/SkFollowingFeedEntry.vue b/packages/frontend/src/components/SkFollowingFeedEntry.vue index 047ec9144b..40249458e5 100644 --- a/packages/frontend/src/components/SkFollowingFeedEntry.vue +++ b/packages/frontend/src/components/SkFollowingFeedEntry.vue @@ -20,7 +20,7 @@ Selectable entry on the "Following" feed, displaying a user with their most rece
- +
diff --git a/packages/frontend/src/utility/get-note-summary.ts b/packages/frontend/src/utility/get-note-summary.ts index 57be0a006c..424f298528 100644 --- a/packages/frontend/src/utility/get-note-summary.ts +++ b/packages/frontend/src/utility/get-note-summary.ts @@ -9,9 +9,10 @@ import { i18n } from '@/i18n.js'; /** * 投稿を表す文字列を取得します。 - * @param {*} note (packされた)投稿 + * @param note (packされた)投稿 + * @param withMandatoryCw if true (default), include the note/user/instance mandatory CW */ -export const getNoteSummary = (note?: Misskey.entities.Note | null): string => { +export const getNoteSummary = (note: Misskey.entities.Note | null | undefined, withMandatoryCw = true): string => { if (note == null) { return ''; } @@ -28,14 +29,16 @@ export const getNoteSummary = (note?: Misskey.entities.Note | null): string => { // Append mandatory CW, if applicable let cw = note.cw; - if (note.mandatoryCW) { - cw = appendContentWarning(cw, note.mandatoryCW); - } - if (note.user.mandatoryCW) { - cw = appendContentWarning(cw, note.user.mandatoryCW); - } - if (note.user.instance?.mandatoryCW) { - cw = appendContentWarning(cw, note.user.instance.mandatoryCW); + if (withMandatoryCw) { + if (note.mandatoryCW) { + cw = appendContentWarning(cw, note.mandatoryCW); + } + if (note.user.mandatoryCW) { + cw = appendContentWarning(cw, note.user.mandatoryCW); + } + if (note.user.instance?.mandatoryCW) { + cw = appendContentWarning(cw, note.user.instance.mandatoryCW); + } } // 本文