feat(backend): add option to exclude sensitive channel

This commit is contained in:
anatawa12 2023-08-06 19:48:58 +09:00
parent b2fc19c3e7
commit 03f01b6ffc
No known key found for this signature in database
GPG Key ID: 9CA909848B8E4EA6
1 changed files with 9 additions and 0 deletions

View File

@ -48,6 +48,7 @@ export const paramDef = {
type: 'string',
} },
excludeNsfw: { type: 'boolean', default: false },
includeSensitiveChannel: { type: 'boolean', default: true },
},
required: ['userId'],
} as const;
@ -79,6 +80,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
.leftJoinAndSelect('reply.user', 'replyUser')
.leftJoinAndSelect('renote.user', 'renoteUser');
if (!ps.includeSensitiveChannel) {
query.leftJoinAndSelect('note.channel', 'channel')
.andWhere(new Brackets((qb) => {
qb.where('channel.isSensitive IS NULL')
.orWhere('channel.isSensitive = FALSE');
}));
}
this.queryService.generateVisibilityQuery(query, me);
if (me) {
this.queryService.generateMutedUserQuery(query, me, user);