From f7e2f62022592a6f89280ac50f0868c681c1303b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 20 Feb 2022 12:48:38 +0300 Subject: [PATCH] fix Feeds::_get_counters() used improperly as a replacement for getFeedUnread() --- classes/api.php | 12 ++++++------ classes/counters.php | 2 +- classes/feeds.php | 2 +- classes/pref/feeds.php | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/classes/api.php b/classes/api.php index fd2573033..b17114693 100755 --- a/classes/api.php +++ b/classes/api.php @@ -106,7 +106,7 @@ class API extends Handler { $is_cat = self::_param_to_bool($_REQUEST["is_cat"] ?? false); if ($feed_id) { - return $this->_wrap(self::STATUS_OK, array("unread" => Feeds::_get_counters($feed_id, $is_cat))); + return $this->_wrap(self::STATUS_OK, array("unread" => Feeds::_get_counters($feed_id, $is_cat, true))); } else { return $this->_wrap(self::STATUS_OK, array("unread" => Feeds::_get_global_unread())); } @@ -152,7 +152,7 @@ class API extends Handler { foreach ($categories->find_many() as $category) { if ($include_empty || $category->num_feeds > 0 || $category->num_cats > 0) { - $unread = Feeds::_get_counters($category->id, true); + $unread = Feeds::_get_counters($category->id, true, true); if ($enable_nested) $unread += Feeds::_get_cat_children_unread($category->id); @@ -170,7 +170,7 @@ class API extends Handler { foreach ([-2,-1,0] as $cat_id) { if ($include_empty || !$this->_is_cat_empty($cat_id)) { - $unread = Feeds::_get_counters($cat_id, true); + $unread = Feeds::_get_counters($cat_id, true, true); if ($unread || !$unread_only) { array_push($cats, [ @@ -546,7 +546,7 @@ class API extends Handler { if ($cat_id == -4 || $cat_id == -1) { foreach ([-1, -2, -3, -4, -6, 0] as $i) { - $unread = Feeds::_get_counters($i); + $unread = Feeds::_get_counters($i, false, true); if ($unread || !$unread_only) { $title = Feeds::_get_title($i); @@ -573,7 +573,7 @@ class API extends Handler { ->find_many(); foreach ($categories as $category) { - $unread = Feeds::_get_counters($category->id, true) + + $unread = Feeds::_get_counters($category->id, true, true) + Feeds::_get_cat_children_unread($category->id); if ($unread || !$unread_only) { @@ -607,7 +607,7 @@ class API extends Handler { } foreach ($feeds_obj->find_many() as $feed) { - $unread = Feeds::_get_counters($feed->id); + $unread = Feeds::_get_counters($feed->id, false, true); $has_icon = Feeds::_has_icon($feed->id); if ($unread || !$unread_only) { diff --git a/classes/counters.php b/classes/counters.php index 0814bc441..8756b5acf 100644 --- a/classes/counters.php +++ b/classes/counters.php @@ -250,7 +250,7 @@ class Counters { for ($i = 0; $i >= -4; $i--) { - $count = Feeds::_get_counters($i); + $count = Feeds::_get_counters($i, false, true); if ($i == 0 || $i == -1 || $i == -2) $auxctr = Feeds::_get_counters($i, false); diff --git a/classes/feeds.php b/classes/feeds.php index 4f30ad746..6f812b98c 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -1507,7 +1507,7 @@ class Feeds extends Handler_Protected { $view_query_part = " "; } else if ($feed != -1) { - $unread = Feeds::_get_counters($feed, $cat_view); + $unread = Feeds::_get_counters($feed, $cat_view, true); if ($cat_view && $feed > 0 && $include_children) $unread += self::_get_cat_children_unread($feed); diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index f5b6333a6..b90ce49b4 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1111,7 +1111,7 @@ class Pref_Feeds extends Handler_Protected { $title = Feeds::_get_title($feed_id, false); if ($unread === false) - $unread = Feeds::_get_counters($feed_id, false); + $unread = Feeds::_get_counters($feed_id, false, true); return [ 'id' => 'FEED:' . $feed_id,