restore appendContentWarning

This commit is contained in:
Hazelnoot 2025-09-13 11:06:08 -04:00
parent d118333f54
commit c66020c6cd
2 changed files with 8 additions and 6 deletions

View file

@ -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';
/**
@ -23,16 +24,16 @@ export const getNoteSummary = (note: Packed<'Note'>): string => {
// Append mandatory CW, if applicable
let cw = note.cw;
if (note.mandatoryCW) {
cw = `Note is flagged: "${note.mandatoryCW}", ${cw}`;
cw = appendContentWarning(cw, `Note is flagged: "${note.mandatoryCW}"`);
}
if (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}`;
cw = appendContentWarning(cw, `${username} is flagged: "${note.user.mandatoryCW}"`);
}
if (note.user.instance?.mandatoryCW) {
cw = `${note.user.host} is flagged: "${note.user.instance.mandatoryCW}", ${cw}`;
cw = appendContentWarning(cw, `${note.user.host} is flagged: "${note.user.instance.mandatoryCW}"`);
}
// 本文