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',
|
type: 'string',
|
||||||
} },
|
} },
|
||||||
excludeNsfw: { type: 'boolean', default: false },
|
excludeNsfw: { type: 'boolean', default: false },
|
||||||
|
includeSensitiveChannel: { type: 'boolean', default: true },
|
||||||
},
|
},
|
||||||
required: ['userId'],
|
required: ['userId'],
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -79,6 +80,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
.leftJoinAndSelect('reply.user', 'replyUser')
|
.leftJoinAndSelect('reply.user', 'replyUser')
|
||||||
.leftJoinAndSelect('renote.user', 'renoteUser');
|
.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);
|
this.queryService.generateVisibilityQuery(query, me);
|
||||||
if (me) {
|
if (me) {
|
||||||
this.queryService.generateMutedUserQuery(query, me, user);
|
this.queryService.generateMutedUserQuery(query, me, user);
|
||||||
|
|
Loading…
Reference in New Issue