restore appendContentWarning
This commit is contained in:
parent
d118333f54
commit
c66020c6cd
2 changed files with 8 additions and 6 deletions
|
|
@ -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}"`);
|
||||
}
|
||||
|
||||
// 本文
|
||||
|
|
|
|||
|
|
@ -4,6 +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,17 +32,17 @@ export const getNoteSummary = (note: Misskey.entities.Note | null | undefined, w
|
|||
let cw = note.cw;
|
||||
if (withMandatoryCw) {
|
||||
if (note.mandatoryCW) {
|
||||
cw = i18n.tsx.noteIsFlaggedAs({ cw: note.mandatoryCW }) + ', ' + cw;
|
||||
cw = appendContentWarning(cw, i18n.tsx.noteIsFlaggedAs({ cw: note.mandatoryCW }));
|
||||
}
|
||||
if (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;
|
||||
cw = appendContentWarning(cw, i18n.tsx.userIsFlaggedAs({ name: username, cw: note.user.mandatoryCW }));
|
||||
}
|
||||
if (note.user.instance?.mandatoryCW) {
|
||||
const instanceName = note.user.host ?? host;
|
||||
cw = i18n.tsx.instanceIsFlaggedAs({ name: instanceName, cw: note.user.instance.mandatoryCW }) + ', ' + cw;
|
||||
cw = appendContentWarning(cw, i18n.tsx.instanceIsFlaggedAs({ name: instanceName, cw: note.user.instance.mandatoryCW }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue