mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-15 09:25:57 +00:00
properly update local vfeed counters
This commit is contained in:
36
feedlist.js
36
feedlist.js
@@ -1013,16 +1013,8 @@ function request_counters() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_feedlist_counters() {
|
function set_feedlist_counter(id, ctr) {
|
||||||
try {
|
try {
|
||||||
var rs = db.execute("SELECT feeds.id,COUNT(articles.id) "+
|
|
||||||
"FROM feeds LEFT JOIN articles ON (feed_id = feeds.id) "+
|
|
||||||
"WHERE unread = 1 OR unread IS NULL GROUP BY feeds.id "+
|
|
||||||
"ORDER BY feeds.title");
|
|
||||||
|
|
||||||
while (rs.isValidRow()) {
|
|
||||||
var id = rs.field(0);
|
|
||||||
var ctr = rs.field(1);
|
|
||||||
|
|
||||||
var feedctr = document.getElementById("FEEDCTR-" + id);
|
var feedctr = document.getElementById("FEEDCTR-" + id);
|
||||||
var feedu = document.getElementById("FEEDU-" + id);
|
var feedu = document.getElementById("FEEDU-" + id);
|
||||||
@@ -1059,15 +1051,39 @@ function update_feedlist_counters() {
|
|||||||
feedr.className = feedr.className.replace("Unread", "");
|
feedr.className = feedr.className.replace("Unread", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("set_feedlist_counter", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_local_feedlist_counters() {
|
||||||
|
try {
|
||||||
|
if (!db) return;
|
||||||
|
|
||||||
|
var rs = db.execute("SELECT feeds.id,COUNT(articles.id) "+
|
||||||
|
"FROM feeds LEFT JOIN articles ON (feed_id = feeds.id) "+
|
||||||
|
"WHERE unread = 1 OR unread IS NULL GROUP BY feeds.id "+
|
||||||
|
"ORDER BY feeds.title");
|
||||||
|
|
||||||
|
while (rs.isValidRow()) {
|
||||||
|
var id = rs.field(0);
|
||||||
|
var ctr = rs.field(1);
|
||||||
|
|
||||||
|
set_feedlist_counter(id, ctr);
|
||||||
|
|
||||||
rs.next();
|
rs.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_feedlist_counter(-4, get_local_feed_unread(-4));
|
||||||
|
set_feedlist_counter(-1, get_local_feed_unread(-1));
|
||||||
|
|
||||||
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
|
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
|
||||||
|
|
||||||
global_unread = get_local_feed_unread(-4);
|
global_unread = get_local_feed_unread(-4);
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("update_feedlist_counters", e);
|
exception_error("update_local_feedlist_counters", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -628,6 +628,8 @@ function all_counters_callback2(transport, async_call) {
|
|||||||
try {
|
try {
|
||||||
if (async_call) async_counters_work = true;
|
if (async_call) async_counters_work = true;
|
||||||
|
|
||||||
|
if (offline_mode) return;
|
||||||
|
|
||||||
debug("<b>all_counters_callback2 IN: " + transport + "</b>");
|
debug("<b>all_counters_callback2 IN: " + transport + "</b>");
|
||||||
parse_counters_reply(transport);
|
parse_counters_reply(transport);
|
||||||
debug("<b>all_counters_callback2 OUT: " + transport + "</b>");
|
debug("<b>all_counters_callback2 OUT: " + transport + "</b>");
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ function view_offline(id, feed_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render_article("FIXME");
|
render_article("FIXME");
|
||||||
update_feedlist_counters();
|
update_local_feedlist_counters();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -585,6 +585,8 @@ function toggleMark(id, client_only, no_effects) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_local_feedlist_counters();
|
||||||
|
|
||||||
if (!client_only) {
|
if (!client_only) {
|
||||||
debug(query);
|
debug(query);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user