summaryrefslogtreecommitdiff
path: root/offline.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-02-07 11:10:08 +0300
committerAndrew Dolgov <[email protected]>2009-02-07 11:10:08 +0300
commit67625745091788b14d7bb8d786f947ba8da29b9a (patch)
tree6475f1911bd42e7d33527cb84a2b721dd54a9be2 /offline.js
parent6b6842996cde8df0c6cf6eb5a65d2530676c765d (diff)
offline: implement local catchup
Diffstat (limited to 'offline.js')
-rw-r--r--offline.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/offline.js b/offline.js
index 7402d61c6..e6d5c48a2 100644
--- a/offline.js
+++ b/offline.js
@@ -103,6 +103,10 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
}
}
+ if (subop == "MarkAllRead") {
+ catchup_local_feed(feed_id, is_cat);
+ }
+
disableContainerChildren("headlinesToolbar", false);
Form.enable("main_toolbar_form");
@@ -1266,3 +1270,28 @@ function update_local_sync_data() {
exception_error("update_local_sync_data", e);
}
}
+
+function catchup_local_feed(id, is_cat) {
+ try {
+ if (!is_cat) {
+ if (id >= 0) {
+ db.execute("UPDATE articles SET unread = 0 WHERE feed_id = ?", [id]);
+ } else if (id == -1) {
+ db.execute("UPDATE articles SET unread = 0 WHERE marked = 1");
+ } else if (id == -4) {
+ db.execute("UPDATE articles SET unread = 0");
+ } else if (id < -10) {
+ var label_id = -11-id;
+
+ db.execute("UPDATE articles SET unread = 0 WHERE "+
+ "(SELECT COUNT(*) FROM article_labels WHERE "+
+ "article_labels.id = articles.id AND label_id = ?) > 0", [label_id]);
+ }
+ }
+
+ update_local_feedlist_counters();
+
+ } catch (e) {
+ exception_error("catchup_local_feed", e);
+ }
+}