From 4ca3c054879e8da3a2d65c772099b8bbd4c371b6 Mon Sep 17 00:00:00 2001 From: Marie Date: Thu, 21 Dec 2023 23:15:03 +0100 Subject: [PATCH] upd: make new posts be marked as NSFW if instance is marked as NSFW Closes #226 --- packages/backend/src/core/NoteCreateService.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 2055a0d21..939662707 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -368,6 +368,14 @@ export class NoteCreateService implements OnApplicationShutdown { } } + if (user.host && !data.cw) { + await this.federatedInstanceService.fetch(user.host).then(async i => { + if (i.isNSFW) { + data.cw = 'Instance is marked as NSFW'; + } + }); + } + const note = await this.insertNote(user, data, tags, emojis, mentionedUsers); setImmediate('post created', { signal: this.#shutdownController.signal }).then(