From f3ce8564ea937f486c1e8585519c8320c15d1911 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Tue, 12 Feb 2019 17:19:15 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=88=E3=81=8F=E8=A9=B1=E3=81=99=E3=83=A6?= =?UTF-8?q?=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=8B=E3=82=89=E3=82=B5=E3=82=B9?= =?UTF-8?q?=E3=83=9A=E3=83=B3=E3=83=89=E3=81=95=E3=82=8C=E3=81=9F=E3=83=A6?= =?UTF-8?q?=E3=83=BC=E3=82=B6=E3=83=BC=E3=82=92=E9=9A=A0=E3=81=99=E3=81=AA?= =?UTF-8?q?=E3=81=A9=20(#4228)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Resolve #4226 * fix * Fix: anonymousでアクセスするとサスペンドユーザーが隠れない * fix --- src/server/api/common/get-hide-users.ts | 2 +- .../api/endpoints/users/get_frequently_replied_users.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/server/api/common/get-hide-users.ts b/src/server/api/common/get-hide-users.ts index 968b357ab..3cdf80675 100644 --- a/src/server/api/common/get-hide-users.ts +++ b/src/server/api/common/get-hide-users.ts @@ -4,7 +4,7 @@ import User, { IUser } from '../../../models/user'; import { unique } from '../../../prelude/array'; export async function getHideUserIds(me: IUser) { - return me ? await getHideUserIdsById(me._id) : []; + return await getHideUserIdsById(me ? me._id : null); } export async function getHideUserIdsById(meId?: mongo.ObjectID) { diff --git a/src/server/api/endpoints/users/get_frequently_replied_users.ts b/src/server/api/endpoints/users/get_frequently_replied_users.ts index 6bbac6a29..74de7b458 100644 --- a/src/server/api/endpoints/users/get_frequently_replied_users.ts +++ b/src/server/api/endpoints/users/get_frequently_replied_users.ts @@ -4,6 +4,7 @@ import Note from '../../../../models/note'; import User, { pack } from '../../../../models/user'; import define from '../../define'; import { maximum } from '../../../../prelude/array'; +import { getHideUserIds } from '../../common/get-hide-users'; export const meta = { requireCredential: false, @@ -62,12 +63,15 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => { return res([]); } + const hideUserIds = await getHideUserIds(me); + hideUserIds.push(user._id); + const replyTargetNotes = await Note.find({ _id: { $in: recentNotes.map(p => p.replyId) }, userId: { - $ne: user._id + $nin: hideUserIds } }, { fields: {