From ac423f1ef4444e864470ab4576c751e4986e688b Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 30 Dec 2018 01:40:24 +0900 Subject: [PATCH] =?UTF-8?q?[API]=20notes/mentions=20=E3=81=AB=E3=83=9F?= =?UTF-8?q?=E3=83=A5=E3=83=BC=E3=83=88=E3=82=92=E9=81=A9=E7=94=A8=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/api/endpoints/notes/mentions.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/server/api/endpoints/notes/mentions.ts b/src/server/api/endpoints/notes/mentions.ts index a353165cd0..4c7c397c77 100644 --- a/src/server/api/endpoints/notes/mentions.ts +++ b/src/server/api/endpoints/notes/mentions.ts @@ -4,6 +4,7 @@ import { getFriendIds } from '../../common/get-friends'; import { packMany } from '../../../../models/note'; import define from '../../define'; import read from '../../../../services/note/read'; +import Mute from '../../../../models/mute'; export const meta = { desc: { @@ -56,6 +57,25 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => { }] } as any; + // ミュートしているユーザーを取得 + const mutedUserIds = (await Mute.find({ + muterId: user._id + })).map(m => m.muteeId); + + if (mutedUserIds && mutedUserIds.length > 0) { + query.userId = { + $nin: mutedUserIds + }; + + query['_reply.userId'] = { + $nin: mutedUserIds + }; + + query['_renote.userId'] = { + $nin: mutedUserIds + }; + } + const sort = { _id: -1 };