From: Andrew Dolgov Date: Sun, 13 Aug 2006 09:45:30 +0000 (+0100) Subject: rework auto-refresh method if number of subscriptions changed X-Git-Tag: schema_freeze_for_1.2.2~15 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=7bf7e4d3ef9b2993f24caff2339fcf78a2027321;p=tt-rss.git rework auto-refresh method if number of subscriptions changed --- diff --git a/functions.js b/functions.js index 4ab997d8..26909302 100644 --- a/functions.js +++ b/functions.js @@ -490,15 +490,16 @@ function parse_counters(reply, scheduled_call) { var has_img = reply.childNodes[l].getAttribute("hi"); var updated = reply.childNodes[l].getAttribute("updated"); - if (t == "feed") { - feeds_found++; - } - if (id == "global-unread") { title_obj.global_unread = ctr; title_obj.updateTitle(); continue; } + + if (id == "subscribed-feeds") { + feeds_found = ctr; + continue; + } if (t == "category") { var catctr = f_document.getElementById("FCATCTR-" + id); @@ -573,10 +574,9 @@ function parse_counters(reply, scheduled_call) { debug("Feed counters, C: " + feeds_found + ", S:" + feeds_stored); if (feeds_stored != feeds_found) { - if (feeds_found != 0) { - getMainContext().number_of_feeds = feeds_found; - } - if (feeds_stored != 0 && feeds_found != 0) { + getMainContext().number_of_feeds = feeds_found; + + if (feeds_stored != 0) { debug("Subscribed feed number changed, refreshing feedlist"); updateFeedList(); } diff --git a/functions.php b/functions.php index a46061bd..4ca5582d 100644 --- a/functions.php +++ b/functions.php @@ -1562,7 +1562,17 @@ if ($global_unread == -1) { $global_unread = getGlobalUnread($link); } - print ""; + print ""; + + $result = db_query($link, "SELECT COUNT(id) AS fn FROM + ttrss_feeds WHERE owner_uid = " . $_SESSION["uid"]); + + $subscribed_feeds = db_fetch_result($result, 0, "fn"); + + print ""; + } function getTagCounters($link, $smart_mode = SMART_RPC_COUNTERS) {