From 7ff8fb027da0e83f1c20acfaf492889f8c97ff3e 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 090c14eb83..4504d23512 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 4869bd09fd..49e1ab0283 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 != \'{}\'');