make QueryService.generateSuspendedUserQueryForNote automatically add all required joins
This commit is contained in:
parent
f1fc8bc357
commit
96ee635765
1 changed files with 7 additions and 2 deletions
|
|
@ -663,9 +663,14 @@ export class QueryService {
|
|||
return q[join](`NOT EXISTS (${threadMutedQuery.getQuery()})`, threadMutedQuery.getParameters());
|
||||
}
|
||||
|
||||
// Requirements: user replyUser renoteUser must be joined
|
||||
@bindThis
|
||||
public generateSuspendedUserQueryForNote(q: SelectQueryBuilder<any>, excludeAuthor?: boolean): void {
|
||||
public generateSuspendedUserQueryForNote<E extends ObjectLiteral>(q: SelectQueryBuilder<E>, excludeAuthor?: boolean): void {
|
||||
this.leftJoin(q, 'note.user', 'user');
|
||||
this.leftJoin(q, 'note.reply', 'reply');
|
||||
this.leftJoin(q, 'note.renote', 'renote');
|
||||
this.leftJoin(q, 'reply.user', 'replyUser');
|
||||
this.leftJoin(q, 'renote.user', 'renoteUser');
|
||||
|
||||
if (excludeAuthor) {
|
||||
const brakets = (user: string) => new Brackets(qb => qb
|
||||
.where(`note.${user}Id IS NULL`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue