add limit on interesting people
This commit is contained in:
@@ -93,7 +93,7 @@ userDB = (DB) => {
|
||||
});
|
||||
}
|
||||
|
||||
DB.getFriendsFriends = async (profileId) => {
|
||||
DB.getFriendsFriends = async (profileId, limit = 10) => {
|
||||
const profile = await DB.getProfile(profileId);
|
||||
if(!profile) return [];
|
||||
let ids = profile.following.map((id)=>DB.ObjectID(id));
|
||||
@@ -102,7 +102,7 @@ userDB = (DB) => {
|
||||
profile.following.forEach(id => {
|
||||
if(!alreadyFollowingMap[id]) alreadyFollowingMap[id] = 1;
|
||||
})
|
||||
return DB.profileCols.find({_id:{$in: ids}}).project({following: 1}).toArray().then(profiles => {
|
||||
return DB.profileCols.find({_id:{$in: ids}}).project({following: 1}).limit(limit).toArray().then(profiles => {
|
||||
let friendsOfFriendsMap = {};
|
||||
profiles.forEach(p => {
|
||||
p.following.forEach(followingId => {
|
||||
|
||||
Reference in New Issue
Block a user