add user-level "force content warning" moderation feature

This commit is contained in:
Hazelnoot 2025-01-28 01:47:03 -05:00
parent 2bf8648ebc
commit ea89348b62
11 changed files with 534 additions and 407 deletions

View file

@ -230,6 +230,7 @@ export class NoteEditService implements OnApplicationShutdown {
host: MiUser['host'];
isBot: MiUser['isBot'];
noindex: MiUser['noindex'];
mandatoryCW: MiUser['mandatoryCW'];
}, editid: MiNote['id'], data: Option, silent = false): Promise<MiNote> {
if (!editid) {
throw new Error('fail');
@ -396,6 +397,15 @@ export class NoteEditService implements OnApplicationShutdown {
data.cw = null;
}
// Apply mandatory CW, if applicable
if (user.mandatoryCW) {
if (data.cw) {
data.cw += `, ${user.mandatoryCW}`;
} else {
data.cw = user.mandatoryCW;
}
}
let tags = data.apHashtags;
let emojis = data.apEmojis;
let mentionedUsers = data.apMentions;