]> git.wh0rd.org Git - tt-rss.git/commitdiff
simplify catching up of feeds, do not reload headlines buffer on catchup unless on_ca...
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 29 Mar 2012 11:03:48 +0000 (15:03 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 29 Mar 2012 11:03:48 +0000 (15:03 +0400)
classes/feeds.php
js/feedlist.js
js/tt-rss.js

index 2f4870f913087f707e61070315a45783a3704fff..aacad55084c71cd9a52b6f697be5b0c354629062 100644 (file)
@@ -177,28 +177,11 @@ class Feeds extends Protected_Handler {
 \r
                $method_split = explode(":", $method);\r
 \r
-/*             if ($method == "CatchupSelected") {\r
-                       $ids = explode(",", db_escape_string($_REQUEST["ids"]));\r
-                       $cmode = sprintf("%d", $_REQUEST["cmode"]);\r
-\r
-                       catchupArticlesById($this->link, $ids, $cmode);\r
-               } */\r
-\r
                if ($method == "ForceUpdate" && $feed && is_numeric($feed) > 0) {\r
                        include "rssfuncs.php";\r
                        update_rss_feed($this->link, $feed, true);\r
                }\r
 \r
-               if ($method == "MarkAllRead")  {\r
-                       catchup_feed($this->link, $feed, $cat_view);\r
-\r
-                       if (get_pref($this->link, 'ON_CATCHUP_SHOW_NEXT_FEED')) {\r
-                               if ($next_unread_feed) {\r
-                                       $feed = $next_unread_feed;\r
-                               }\r
-                       }\r
-               }\r
-\r
                if ($method_split[0] == "MarkAllReadGR")  {\r
                        catchup_feed($this->link, $method_split[1], false);\r
                }\r
@@ -443,7 +426,7 @@ class Feeds extends Protected_Handler {
 \r
                                                        $cur_feed_title = htmlspecialchars($cur_feed_title);\r
 \r
-                                                       $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id);' href='#'>".__('mark as read')."</a>)";\r
+                                                       $vf_catchup_link = "(<a onclick='catchupFeedInGroup($feed_id);' href='#'>".__('mark as read')."</a>)";\r
 \r
                                                        $reply['content'] .= "<div class='cdmFeedTitle'>".\r
                                                                "<div style=\"float : right\">$feed_icon_img</div>".\r
index 271d2059e03b377d7b3ff0e4d3dd28b433dc1184..7262d6aa36aac2aa334ed3ac8c5aadb2ac162765 100644 (file)
@@ -148,39 +148,6 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req) {
                                _search_query = false;
                        }
 
-                       if (method == "MarkAllRead") {
-
-                               var show_next_feed = getInitParam("on_catchup_show_next_feed") == "1";
-
-                               if (show_next_feed) {
-                                       var nuf = getNextUnreadFeed(feed, is_cat);
-
-                                       if (nuf) {
-                                               var cached_nuf = cache_get("feed:" + nuf + ":false");
-
-                                               if (cached_nuf) {
-
-                                                       render_local_headlines(nuf, false, JSON.parse(cached_nuf));
-
-                                                       var catchup_query = "?op=rpc&method=catchupFeed&feed_id=" +
-                                                               feed + "&is_cat=" + is_cat;
-
-                                                       console.log(catchup_query);
-
-                                                       new Ajax.Request("backend.php", {
-                                                               parameters: catchup_query,
-                                                               onComplete: function(transport) {
-                                                                       handle_rpc_json(transport);
-                                                               } });
-
-                                                       return;
-                                               } else {
-                                                       query += "&nuf=" + param_escape(nuf);
-                                               }
-                                       }
-                               }
-                       }
-
                        if (offset != 0) {
                                query = query + "&skip=" + offset;
 
@@ -476,6 +443,26 @@ function getNextUnreadFeed(feed, is_cat) {
        }
 }
 
+function catchupCurrentFeed() {
+       return catchupFeed(getActiveFeedId(), activeFeedIsCat());
+}
+
+function catchupFeedInGroup(id) {
+       try {
+
+               var title = getFeedName(id);
+
+               var str = __("Mark all articles in %s as read?").replace("%s", title);
+
+               if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
+                       return viewCurrentFeed('MarkAllReadGR:' + id);
+               }
+
+       } catch (e) {
+               exception_error("catchupFeedInGroup", e);
+       }
+}
+
 function catchupFeed(feed, is_cat) {
        try {
                var str = __("Mark all articles in %s as read?");
@@ -496,6 +483,26 @@ function catchupFeed(feed, is_cat) {
                        parameters: catchup_query,
                        onComplete: function(transport) {
                                        handle_rpc_json(transport);
+
+                                       if (feed == getActiveFeedId() && is_cat == activeFeedIsCat()) {
+
+                                               $$("#headlines-frame > div[id*=RROW][class*=Unread]").each(
+                                                       function(child) {
+                                                               child.removeClassName("Unread");
+                                                       }
+                                               );
+                                       }
+
+                                       var show_next_feed = getInitParam("on_catchup_show_next_feed") == "1";
+
+                                       if (show_next_feed) {
+                                               var nuf = getNextUnreadFeed(feed, is_cat);
+
+                                               if (nuf) {
+                                                       viewfeed(nuf);
+                                               }
+                                       }
+
                                        notify("");
                                } });
 
index 5804ee501b71185a91b49f07141b4de29ced2f99..ef5d72e5b96b88b71ec273cb6705df735a33a49f 100644 (file)
@@ -504,34 +504,6 @@ function parse_runtime_info(data) {
        }
 }
 
-function catchupCurrentFeed() {
-
-       var fn = getFeedName(getActiveFeedId(), activeFeedIsCat());
-
-       var str = __("Mark all articles in %s as read?").replace("%s", fn);
-
-       if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
-               return viewCurrentFeed('MarkAllRead');
-       }
-}
-
-function catchupFeedInGroup(id) {
-
-       try {
-
-               var title = getFeedName(id);
-
-               var str = __("Mark all articles in %s as read?").replace("%s", title);
-
-               if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
-                       return viewCurrentFeed('MarkAllReadGR:' + id);
-               }
-
-       } catch (e) {
-               exception_error("catchupFeedInGroup", e);
-       }
-}
-
 function collapse_feedlist() {
        try {