summaryrefslogtreecommitdiff
path: root/classes/api.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2014-10-27 22:07:20 +0300
committerAndrew Dolgov <[email protected]>2014-10-27 22:07:20 +0300
commitf71a669b7dc9e2048cfea02f39ab4ef8cde4178a (patch)
treea5b23716ba7494af8fcde6742d5b08feaccc829a /classes/api.php
parent98cbae8dfa9e9d30fe2e843c7058d99671a830ba (diff)
api: handle uncached labels the way main headlines function does it
Diffstat (limited to 'classes/api.php')
-rw-r--r--classes/api.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/classes/api.php b/classes/api.php
index 97f17cc74..730e20ab9 100644
--- a/classes/api.php
+++ b/classes/api.php
@@ -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"]);