]> git.wh0rd.org Git - tt-rss.git/commitdiff
api: handle uncached labels the way main headlines function does it
authorAndrew Dolgov <noreply@fakecake.org>
Mon, 27 Oct 2014 19:07:20 +0000 (22:07 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Mon, 27 Oct 2014 19:07:20 +0000 (22:07 +0300)
classes/api.php

index 97f17cc748c69139ce078955dd307d44b83f852c..730e20ab923c31250b031b43e9da1dff7efb0b97 100644 (file)
@@ -675,7 +675,22 @@ class API extends Handler {
                                        ($line["unread"] != "t" && $line["unread"] != "1"));
 
                                $tags = explode(",", $line["tag_cache"]);
-                               $labels = json_decode($line["label_cache"], true);
+
+                               $label_cache = $line["label_cache"];
+                               $labels = false;
+
+                               if ($label_cache) {
+                                       $label_cache = json_decode($label_cache, true);
+
+                                       if ($label_cache) {
+                                               if ($label_cache["no-labels"] == 1)
+                                                       $labels = array();
+                                               else
+                                                       $labels = $label_cache;
+                                       }
+                               }
+
+                               if (!is_array($labels)) $labels = get_article_labels($line["id"]);
 
                                //if (!$tags) $tags = get_article_tags($line["id"]);
                                //if (!$labels) $labels = get_article_labels($line["id"]);