From 97371bd893cb95d86b860326b8e8747635b85cba Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Fri, 12 Sep 2025 14:16:16 -0400 Subject: [PATCH] update get-note-summary (both copies) to use same wording as SkMutedNote --- packages/backend/src/misc/get-note-summary.ts | 10 ++++++---- packages/frontend/src/utility/get-note-summary.ts | 12 ++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/backend/src/misc/get-note-summary.ts b/packages/backend/src/misc/get-note-summary.ts index 3a725e4f43..079eda6fbb 100644 --- a/packages/backend/src/misc/get-note-summary.ts +++ b/packages/backend/src/misc/get-note-summary.ts @@ -3,7 +3,6 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { appendContentWarning } from './append-content-warning.js'; import type { Packed } from './json-schema.js'; /** @@ -24,13 +23,16 @@ export const getNoteSummary = (note: Packed<'Note'>): string => { // Append mandatory CW, if applicable let cw = note.cw; if (note.mandatoryCW) { - cw = appendContentWarning(cw, note.mandatoryCW); + cw = `Note is flagged: "${note.mandatoryCW}", ${cw}`; } if (note.user.mandatoryCW) { - cw = appendContentWarning(cw, note.user.mandatoryCW); + const username = note.user.host + ? `@${note.user.username}@${note.user.host}` + : `@${note.user.username}`; + cw = `${username} is flagged: "${note.user.mandatoryCW}", ${cw}`; } if (note.user.instance?.mandatoryCW) { - cw = appendContentWarning(cw, note.user.instance.mandatoryCW); + cw = `${note.user.host} is flagged: "${note.user.instance.mandatoryCW}", ${cw}`; } // 本文 diff --git a/packages/frontend/src/utility/get-note-summary.ts b/packages/frontend/src/utility/get-note-summary.ts index 424f298528..f96f75b8a9 100644 --- a/packages/frontend/src/utility/get-note-summary.ts +++ b/packages/frontend/src/utility/get-note-summary.ts @@ -4,7 +4,7 @@ */ import * as Misskey from 'misskey-js'; -import { appendContentWarning } from '@@/js/append-content-warning.js'; +import { host } from '@@/js/config.js'; import { i18n } from '@/i18n.js'; /** @@ -31,13 +31,17 @@ export const getNoteSummary = (note: Misskey.entities.Note | null | undefined, w let cw = note.cw; if (withMandatoryCw) { if (note.mandatoryCW) { - cw = appendContentWarning(cw, note.mandatoryCW); + cw = i18n.tsx.noteIsFlaggedAs({ cw: note.mandatoryCW }) + ', ' + cw; } if (note.user.mandatoryCW) { - cw = appendContentWarning(cw, note.user.mandatoryCW); + const username = note.user.host + ? `@${note.user.username}@${note.user.host}` + : `@${note.user.username}`; + cw = i18n.tsx.userIsFlaggedAs({ name: username, cw: note.user.mandatoryCW }) + ', ' + cw; } if (note.user.instance?.mandatoryCW) { - cw = appendContentWarning(cw, note.user.instance.mandatoryCW); + const instanceName = note.user.host ?? host; + cw = i18n.tsx.instanceIsFlaggedAs({ name: instanceName, cw: note.user.instance.mandatoryCW }) + ', ' + cw; } }