summaryrefslogtreecommitdiff
path: root/packages/backend/src/misc/get-note-summary.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/misc/get-note-summary.ts')
-rw-r--r--packages/backend/src/misc/get-note-summary.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/packages/backend/src/misc/get-note-summary.ts b/packages/backend/src/misc/get-note-summary.ts
index 60dddee9a2..be2d3ea98d 100644
--- a/packages/backend/src/misc/get-note-summary.ts
+++ b/packages/backend/src/misc/get-note-summary.ts
@@ -3,6 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
+import { appendContentWarning } from './append-content-warning.js';
import type { Packed } from './json-schema.js';
/**
@@ -20,9 +21,15 @@ export const getNoteSummary = (note: Packed<'Note'>): string => {
let summary = '';
+ // Append mandatory CW, if applicable
+ let cw = note.cw;
+ if (note.user.mandatoryCW) {
+ cw = appendContentWarning(cw, note.user.mandatoryCW);
+ }
+
// 本文
- if (note.cw != null) {
- summary += `CW: ${note.cw}`;
+ if (cw != null) {
+ summary += `CW: ${cw}`;
} else if (note.text) {
summary += note.text;
}