Skip to content

Commit

Permalink
upd: make new posts be marked as NSFW if instance is marked as NSFW
Browse files Browse the repository at this point in the history
  • Loading branch information
Marie authored and Marie committed Dec 21, 2023
1 parent 9c6a7ae commit 4ca3c05
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/backend/src/core/NoteCreateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 4ca3c05

Please sign in to comment.