From 1af3c42001550f573488864593d9739ed83c3cfe Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 11 Jul 2018 14:03:21 +0900 Subject: wip --- src/server/api/common/get-friends.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/server/api/common') diff --git a/src/server/api/common/get-friends.ts b/src/server/api/common/get-friends.ts index 50ba71ea96..e0b05f73df 100644 --- a/src/server/api/common/get-friends.ts +++ b/src/server/api/common/get-friends.ts @@ -23,12 +23,16 @@ export const getFriendIds = async (me: mongodb.ObjectID, includeMe = true) => { return myfollowingIds; }; -export const getFriends = async (me: mongodb.ObjectID, includeMe = true) => { +export const getFriends = async (me: mongodb.ObjectID, includeMe = true, remoteOnly = false) => { + const q: any = remoteOnly ? { + followerId: me, + '_followee.host': { $ne: null } + } : { + followerId: me + }; // Fetch relation to other users who the I follows const followings = await Following - .find({ - followerId: me - }); + .find(q); // ID list of other users who the I follows const myfollowings = followings.map(following => ({ -- cgit v1.2.3-freya