From ea9c4de45b53fc49af27f62c3a10da14461d8e9b Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 18 Apr 2018 18:46:38 +0900 Subject: [PATCH] Fix #1510 --- src/server/api/endpoints/users/recommendation.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/server/api/endpoints/users/recommendation.ts b/src/server/api/endpoints/users/recommendation.ts index e367e65a6..2a6d36b75 100644 --- a/src/server/api/endpoints/users/recommendation.ts +++ b/src/server/api/endpoints/users/recommendation.ts @@ -5,6 +5,7 @@ const ms = require('ms'); import $ from 'cafy'; import User, { pack } from '../../../../models/user'; import getFriends from '../../common/get-friends'; +import Mute from '../../../../models/mute'; /** * Get recommended users @@ -25,13 +26,18 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // ID list of the user itself and other users who the user follows const followingIds = await getFriends(me._id); + // ミュートしているユーザーを取得 + const mutedUserIds = (await Mute.find({ + muterId: me._id + })).map(m => m.muteeId); + const users = await User .find({ _id: { - $nin: followingIds + $nin: followingIds.concat(mutedUserIds) }, $or: [{ - 'lastUsedAt': { + lastUsedAt: { $gte: new Date(Date.now() - ms('7days')) } }, {