feat(backend): add option to exclude sensitive channel
This commit is contained in:
parent
b2fc19c3e7
commit
03f01b6ffc
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue