From 597412abcc8aa4dee671d1d7f37f68d6086cb33c Mon Sep 17 00:00:00 2001 From: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:11:33 +0000 Subject: [PATCH] fix(backend): incorrect typing with query --- packages/backend/src/core/QueryService.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/core/QueryService.ts b/packages/backend/src/core/QueryService.ts index 1d78a991fc..d9d63a8a0b 100644 --- a/packages/backend/src/core/QueryService.ts +++ b/packages/backend/src/core/QueryService.ts @@ -132,8 +132,13 @@ export class QueryService { .select('muting.muteeId') .where('muting.muterId = :muterId', { muterId: me.id }); + const mutingArrayQuery = this.mutingsRepository.createQueryBuilder('muting') + .select('array_agg(muting.muteeId)', 'muting.muteeIdArray') + .where('muting.muterId = :muterId', { muterId: me.id }); + if (exclude) { mutingQuery.andWhere('muting.muteeId != :excludeId', { excludeId: exclude.id }); + mutingArrayQuery.andWhere('muting.muteeId != :excludeId', { excludeId: exclude.id }); } const mutingInstanceQuery = this.userProfilesRepository.createQueryBuilder('user_profile') @@ -177,11 +182,12 @@ export class QueryService { q.andWhere(new Brackets(qb => { qb .where('note.mentions IS NULL') - .orWhere(`NOT (note.mentions && (${ mutingQuery.getQuery() }))`); + .orWhere(`NOT (note.mentions && (${ mutingArrayQuery.getQuery() }))`); })); } q.setParameters(mutingQuery.getParameters()); + q.setParameters(mutingArrayQuery.getParameters()); q.setParameters(mutingInstanceQuery.getParameters()); }