forked from FoundKeyGang/FoundKey
Johann150
457bd5ee3f
Commit fc65190ef7
introduced thread ids but
did not add the thread id to previous notes. This is fixed by this commit.
The original notes in each thread should also have a thread id set which will
be the same as their ID.
These two migrations allow the threadId column be a NOT NULL column.
14 lines
544 B
TypeScript
14 lines
544 B
TypeScript
import { Brackets, SelectQueryBuilder } from 'typeorm';
|
|
import { User } from '@/models/entities/user.js';
|
|
import { NoteThreadMutings } from '@/models/index.js';
|
|
|
|
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.threadId NOT IN (${ mutedQuery.getQuery() })`);
|
|
|
|
q.setParameters(mutedQuery.getParameters());
|
|
}
|