fix(api): アプリケーション通知が取得できない問題を修正

Fix #6702
This commit is contained in:
syuilo
2021-10-19 20:25:47 +09:00
parent 7413634734
commit a96e5277db
3 changed files with 13 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import { makePaginationQuery } from '../../common/make-pagination-query';
import { Notifications, Followings, Mutings, Users } from '@/models/index';
import { notificationTypes } from '@/types';
import read from '@/services/note/read';
import { Brackets } from 'typeorm';
export const meta = {
tags: ['account', 'notifications'],
@ -94,10 +95,16 @@ export default define(meta, async (ps, user) => {
.leftJoinAndSelect('reply.user', 'replyUser')
.leftJoinAndSelect('renote.user', 'renoteUser');
query.andWhere(`notification.notifierId NOT IN (${ mutingQuery.getQuery() })`);
query.andWhere(new Brackets(qb => { qb
.where(`notification.notifierId NOT IN (${ mutingQuery.getQuery() })`)
.orWhere('notification.notifierId IS NULL');
}));
query.setParameters(mutingQuery.getParameters());
query.andWhere(`notification.notifierId NOT IN (${ suspendedQuery.getQuery() })`);
query.andWhere(new Brackets(qb => { qb
.where(`notification.notifierId NOT IN (${ suspendedQuery.getQuery() })`)
.orWhere('notification.notifierId IS NULL');
}));
if (ps.following) {
query.andWhere(`((notification.notifierId IN (${ followingQuery.getQuery() })) OR (notification.notifierId = :meId))`, { meId: user.id });