1
0

factor out shared "compute-merged-cw" routine

This commit is contained in:
Hazelnoot
2025-02-15 11:49:33 -05:00
parent e60fe879d6
commit b2d43040b1
13 changed files with 41 additions and 96 deletions
@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as Misskey from 'misskey-js';
import { appendContentWarning } from '@/js/append-content-warning.js';
export function computeMergedCw(note: Misskey.entities.Note): string | null {
let cw = note.cw;
if (note.user.mandatoryCW) {
cw = appendContentWarning(cw, note.user.mandatoryCW);
}
return cw ?? null;
}