From b8926866f71c9079aeda779c40a4c177c23b5a2a Mon Sep 17 00:00:00 2001 From: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com> Date: Thu, 21 Nov 2024 13:17:43 +0000 Subject: [PATCH] fix(backend): lack of muting empty check --- packages/backend/src/core/QueryService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/core/QueryService.ts b/packages/backend/src/core/QueryService.ts index d9d63a8a0b..5794b15445 100644 --- a/packages/backend/src/core/QueryService.ts +++ b/packages/backend/src/core/QueryService.ts @@ -127,7 +127,7 @@ export class QueryService { } @bindThis - public generateMutedUserQuery(q: SelectQueryBuilder, me: { id: MiUser['id'] }, exclude?: { id: MiUser['id'] }, checkMentions: boolean = true): void { + public generateMutedUserQuery(q: SelectQueryBuilder, me: { id: MiUser['id'] }, exclude?: { id: MiUser['id'] }, checkMentions = true): void { const mutingQuery = this.mutingsRepository.createQueryBuilder('muting') .select('muting.muteeId') .where('muting.muterId = :muterId', { muterId: me.id }); @@ -182,6 +182,7 @@ export class QueryService { q.andWhere(new Brackets(qb => { qb .where('note.mentions IS NULL') + .orWhere(`NOT EXISTS (${ mutingQuery.getQuery() })`) .orWhere(`NOT (note.mentions && (${ mutingArrayQuery.getQuery() }))`); })); }