From 0a7b15207e71acfd219196ff3301f6730f77320f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 27 Feb 2013 16:57:26 +0400 Subject: [PATCH] remove previous counter hacks; force request counters when there's no unread stuff left in current feed (e.g. finished reading) --- classes/rpc.php | 2 -- js/feedlist.js | 2 +- js/viewfeed.js | 6 ++++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/classes/rpc.php b/classes/rpc.php index 18df21b1..46c8b0d8 100644 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -247,8 +247,6 @@ class RPC extends Handler_Protected { if ($last_article_id != getLastArticleId($this->link)) { $reply['counters'] = getAllCounters($this->link); - } else { - $reply['counters'] = getVirtCounters($this->link); } $reply['runtime-info'] = make_runtime_info($this->link); diff --git a/js/feedlist.js b/js/feedlist.js index a9ee19c0..b2aadab6 100644 --- a/js/feedlist.js +++ b/js/feedlist.js @@ -234,7 +234,7 @@ function request_counters(force) { var query = "?op=rpc&method=getAllCounters&seq=" + next_seq(); - if (!force && Math.random() >= 0.5) + if (!force) query = query + "&last_article_id=" + getInitParam("last_article_id"); console.log(query); diff --git a/js/viewfeed.js b/js/viewfeed.js index 1cdfdba3..2f1ba24e 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -325,7 +325,8 @@ function article_callback2(transport, id) { Element.show(dijit.byId("net-alert").domNode); } - request_counters(); + var unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length + request_counters(unread_in_buffer == 0); headlines_scroll_handler($("headlines-frame")); @@ -1550,7 +1551,8 @@ function cdmClicked(event, id) { openArticleInNewWindow(id); } - request_counters(); + var unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length + request_counters(unread_in_buffer == 0); } catch (e) { exception_error("cdmClicked"); -- 2.39.5