diff --git a/src/server/api/common/get-hide-users.ts b/src/server/api/common/get-hide-users.ts index 968b357abc..3cdf806751 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 6bbac6a29d..74de7b4589 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: {