mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-30 22:39:13 +01:00
fix(backend): mention was not considered for mute (query ver)
This commit is contained in:
parent
6d07f683eb
commit
446238026a
2 changed files with 11 additions and 2 deletions
|
@ -127,7 +127,7 @@ export class QueryService {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public generateMutedUserQuery(q: SelectQueryBuilder<any>, me: { id: MiUser['id'] }, exclude?: { id: MiUser['id'] }): void {
|
||||
public generateMutedUserQuery(q: SelectQueryBuilder<any>, me: { id: MiUser['id'] }, exclude?: { id: MiUser['id'] }, checkMentions: boolean = true): void {
|
||||
const mutingQuery = this.mutingsRepository.createQueryBuilder('muting')
|
||||
.select('muting.muteeId')
|
||||
.where('muting.muterId = :muterId', { muterId: me.id });
|
||||
|
@ -172,6 +172,15 @@ export class QueryService {
|
|||
.orWhere(`NOT ((${ mutingInstanceQuery.getQuery() })::jsonb ? note.renoteUserHost)`);
|
||||
}));
|
||||
|
||||
// 投稿に含まれるメンションの相手をミュートしていない
|
||||
if (checkMentions) {
|
||||
q.andWhere(new Brackets(qb => {
|
||||
qb
|
||||
.where('note.mentions IS NULL')
|
||||
.orWhere(`NOT (note.mentions && (${ mutingQuery.getQuery() }))`);
|
||||
}));
|
||||
}
|
||||
|
||||
q.setParameters(mutingQuery.getParameters());
|
||||
q.setParameters(mutingInstanceQuery.getParameters());
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.leftJoinAndSelect('renote.user', 'renoteUser');
|
||||
|
||||
this.queryService.generateVisibilityQuery(query, me);
|
||||
this.queryService.generateMutedUserQuery(query, me);
|
||||
this.queryService.generateMutedUserQuery(query, me, undefined, false); // 通知系ではメンションを確認しないようにする
|
||||
this.queryService.generateMutedNoteThreadQuery(query, me);
|
||||
this.queryService.generateBlockedUserQuery(query, me);
|
||||
|
||||
|
|
Loading…
Reference in a new issue