implement mandatory CW for notes (resolves #910)

This commit is contained in:
Hazelnoot 2025-06-27 22:32:26 -04:00
parent 6f8d831e09
commit 92750240eb
29 changed files with 305 additions and 11 deletions

View file

@ -127,6 +127,7 @@ function generateDummyNote(override?: Partial<MiNote>): MiNote {
renoteUserInstance: null,
updatedAt: null,
processErrors: [],
mandatoryCW: null,
...override,
};
}

View file

@ -497,6 +497,9 @@ export class ApRendererService {
let summary = note.cw === '' ? String.fromCharCode(0x200B) : note.cw;
// Apply mandatory CW, if applicable
if (note.mandatoryCW) {
summary = appendContentWarning(summary, note.mandatoryCW);
}
if (author.mandatoryCW) {
summary = appendContentWarning(summary, author.mandatoryCW);
}

View file

@ -651,6 +651,7 @@ export class NoteEntityService implements OnModuleInit {
user: packedUsers?.get(note.userId) ?? this.userEntityService.pack(note.user ?? note.userId, me),
text: text,
cw: note.cw,
mandatoryCW: note.mandatoryCW,
visibility: note.visibility,
localOnly: note.localOnly,
reactionAcceptance: note.reactionAcceptance,