fix Feeds::_get_counters() used improperly as a replacement for

getFeedUnread()
This commit is contained in:
Andrew Dolgov 2022-02-20 12:48:38 +03:00
parent 77f39d65b5
commit f7e2f62022
4 changed files with 9 additions and 9 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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);

View File

@ -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,