mirror of
https://github.com/paricafe/misskey.git
synced 2025-01-11 21:50:50 -06:00
d071d18dd7
* wip * wip * fix * clean up * Update tsconfig.json * Update activitypub.ts * wip
17 lines
679 B
TypeScript
17 lines
679 B
TypeScript
import { User } from '@/models/entities/user.js';
|
|
import { NoteThreadMutings } from '@/models/index.js';
|
|
import { Brackets, SelectQueryBuilder } from 'typeorm';
|
|
|
|
export function generateMutedNoteThreadQuery(q: SelectQueryBuilder<any>, me: { id: User['id'] }) {
|
|
const mutedQuery = NoteThreadMutings.createQueryBuilder('threadMuted')
|
|
.select('threadMuted.threadId')
|
|
.where('threadMuted.userId = :userId', { userId: me.id });
|
|
|
|
q.andWhere(`note.id NOT IN (${ mutedQuery.getQuery() })`);
|
|
q.andWhere(new Brackets(qb => { qb
|
|
.where(`note.threadId IS NULL`)
|
|
.orWhere(`note.threadId NOT IN (${ mutedQuery.getQuery() })`);
|
|
}));
|
|
|
|
q.setParameters(mutedQuery.getParameters());
|
|
}
|