From df3c05c6fbbd8b13ef0b1ec889926c65e7232dc8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 21 Oct 2019 00:52:50 +0900 Subject: [PATCH] Fix #4731 --- src/server/api/common/generate-mute-query.ts | 6 +++++- src/server/api/endpoints/users/notes.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/server/api/common/generate-mute-query.ts b/src/server/api/common/generate-mute-query.ts index 090c14eb8..4504d2351 100644 --- a/src/server/api/common/generate-mute-query.ts +++ b/src/server/api/common/generate-mute-query.ts @@ -2,11 +2,15 @@ import { User } from '../../../models/entities/user'; import { Mutings } from '../../../models'; import { SelectQueryBuilder, Brackets } from 'typeorm'; -export function generateMuteQuery(q: SelectQueryBuilder, me: User) { +export function generateMuteQuery(q: SelectQueryBuilder, me: User, exclude?: User) { const mutingQuery = Mutings.createQueryBuilder('muting') .select('muting.muteeId') .where('muting.muterId = :muterId', { muterId: me.id }); + if (exclude) { + mutingQuery.andWhere('muting.muteeId != :excludeId', { excludeId: exclude.id }); + } + // 投稿の作者をミュートしていない かつ // 投稿の返信先の作者をミュートしていない かつ // 投稿の引用元の作者をミュートしていない diff --git a/src/server/api/endpoints/users/notes.ts b/src/server/api/endpoints/users/notes.ts index 4869bd09f..49e1ab028 100644 --- a/src/server/api/endpoints/users/notes.ts +++ b/src/server/api/endpoints/users/notes.ts @@ -134,7 +134,7 @@ export default define(meta, async (ps, me) => { .leftJoinAndSelect('note.user', 'user'); if (me) generateVisibilityQuery(query, me); - if (me) generateMuteQuery(query, me); + if (me) generateMuteQuery(query, me, user); if (ps.withFiles) { query.andWhere('note.fileIds != \'{}\'');