From 6f1344a01657037d32d8b5c06203302899ba8a27 Mon Sep 17 00:00:00 2001 From: erqan Date: Mon, 26 May 2014 16:22:40 +0300 Subject: [PATCH] fixed following user's following data update issue --- js/twister_following.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/js/twister_following.js b/js/twister_following.js index 9bde14e..af1d30d 100644 --- a/js/twister_following.js +++ b/js/twister_following.js @@ -110,23 +110,18 @@ TwisterFollowing.prototype = { if (typeof(this.followingsFollowings[followingUsers[i]]) === 'undefined' || ctime - this.followingsFollowings[followingUsers[i]]["lastUpdate"] >= this.followingsFollowings[followingUsers[i]]["updateInterval"]) { - loadFollowingFromDht(followingUsers[i], 1, [], 0, function (args, following, seqNum) { - var updated = false; if (following.indexOf(args.tf.user) > -1) { if (args.tf.knownFollowers.indexOf(args.fu) < 0) { args.tf.knownFollowers.push(args.fu); - updated = true; } } else { if (args.tf.notFollowers.indexOf(args.fu) < 0) { args.tf.notFollowers.push(args.fu); - updated = true; } var tmpi = args.tf.knownFollowers.indexOf(args.fu); if (tmpi > -1) { args.tf.knownFollowers.splice(tmpi, 1); - updated = true; } } $(".open-followers").attr("title", args.tf.knownFollowers.length.toString()); @@ -138,8 +133,6 @@ TwisterFollowing.prototype = { args.tf.followingsFollowings[args.fu]["lastUpdate"] = ctime; args.tf.followingsFollowings[args.fu]["updateInterval"] = TwisterFollowing.minUpdateInterval; args.tf.followingsFollowings[args.fu]["following"] = following; - - updated = true; } else { var diff = []; //diff for following var difu = []; //diff for unfollowing @@ -163,14 +156,13 @@ TwisterFollowing.prototype = { if (diff.length > 0 || difu.length > 0) { args.tf.followingsFollowings[args.fu]["updateInterval"] = TwisterFollowing.minUpdateInterval; args.tf.followingsFollowings[args.fu]["lastUpdate"] = ctime; - updated = true; } else if (args.tf.followingsFollowings[args.fu]["updateInterval"] < TwisterFollowing.maxUpdateInterval) { args.tf.followingsFollowings[args.fu]["updateInterval"] *= 2; + } else { + args.tf.followingsFollowings[args.fu]["lastUpdate"] = ctime; } - - if (updated) - args.tf.save(); } + args.tf.save(); }, {"tf": this, "fu": followingUsers[i]}); } if (oneshot)