From 319e905bf9e5398cb62eaeee7da80ff6e942c094 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Mon, 2 Apr 2018 21:57:36 +0900 Subject: Introduce followed log and following log --- src/models/user.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/models/user.ts') diff --git a/src/models/user.ts b/src/models/user.ts index d3c94cab3e..f817c33aa2 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -234,8 +234,7 @@ export const pack = ( _user.isFollowing = (async () => { const follow = await Following.findOne({ followerId: meId, - followeeId: _user.id, - deletedAt: { $exists: false } + followeeId: _user.id }); return follow !== null; })(); @@ -244,8 +243,7 @@ export const pack = ( _user.isFollowed = (async () => { const follow2 = await Following.findOne({ followerId: _user.id, - followeeId: meId, - deletedAt: { $exists: false } + followeeId: meId }); return follow2 !== null; })(); @@ -275,15 +273,13 @@ export const pack = ( // Get following you know count _user.followingYouKnowCount = Following.count({ followeeId: { $in: myFollowingIds }, - followerId: _user.id, - deletedAt: { $exists: false } + followerId: _user.id }); // Get followers you know count _user.followersYouKnowCount = Following.count({ followeeId: _user.id, - followerId: { $in: myFollowingIds }, - deletedAt: { $exists: false } + followerId: { $in: myFollowingIds } }); } } -- cgit v1.2.3-freya