mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-09-20 01:56:33 +00:00
getExtendedFollows fix
This commit is contained in:
parent
3d7b3619a4
commit
5b020d6747
@ -76,22 +76,19 @@ function removeFollow(k, followDistance, follower) {
|
||||
const getExtendedFollows = _.throttle((callback, k, maxDepth = 3, currentDepth = 1) => {
|
||||
k = k || key.pub;
|
||||
|
||||
const shouldQuery = !follows[k];
|
||||
addFollow(callback, k, currentDepth - 1);
|
||||
|
||||
if (shouldQuery) {
|
||||
State.public.user(k).get('follow').map().on((isFollowing, followedKey) => { // TODO: unfollow
|
||||
if (follows[followedKey] === isFollowing) { return; }
|
||||
if (isFollowing) {
|
||||
addFollow(callback, followedKey, currentDepth, k);
|
||||
if (currentDepth < maxDepth) {
|
||||
_.defer(() => getExtendedFollows(callback, followedKey, maxDepth, currentDepth + 1));
|
||||
}
|
||||
} else {
|
||||
removeFollow(followedKey, currentDepth, k);
|
||||
State.public.user(k).get('follow').map().on((isFollowing, followedKey) => { // TODO: unfollow
|
||||
if (follows[followedKey] === isFollowing) { return; }
|
||||
if (isFollowing) {
|
||||
addFollow(callback, followedKey, currentDepth, k);
|
||||
if (currentDepth < maxDepth) {
|
||||
_.defer(() => getExtendedFollows(callback, followedKey, maxDepth, currentDepth + 1));
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
removeFollow(followedKey, currentDepth, k);
|
||||
}
|
||||
});
|
||||
|
||||
return follows;
|
||||
}, 2000);
|
||||
|
Loading…
Reference in New Issue
Block a user