fix Feeds::_get_counters() used improperly as a replacement for
getFeedUnread()
This commit is contained in:
parent
77f39d65b5
commit
f7e2f62022
|
@ -106,7 +106,7 @@ class API extends Handler {
|
||||||
$is_cat = self::_param_to_bool($_REQUEST["is_cat"] ?? false);
|
$is_cat = self::_param_to_bool($_REQUEST["is_cat"] ?? false);
|
||||||
|
|
||||||
if ($feed_id) {
|
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 {
|
} else {
|
||||||
return $this->_wrap(self::STATUS_OK, array("unread" => Feeds::_get_global_unread()));
|
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) {
|
foreach ($categories->find_many() as $category) {
|
||||||
if ($include_empty || $category->num_feeds > 0 || $category->num_cats > 0) {
|
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)
|
if ($enable_nested)
|
||||||
$unread += Feeds::_get_cat_children_unread($category->id);
|
$unread += Feeds::_get_cat_children_unread($category->id);
|
||||||
|
@ -170,7 +170,7 @@ class API extends Handler {
|
||||||
|
|
||||||
foreach ([-2,-1,0] as $cat_id) {
|
foreach ([-2,-1,0] as $cat_id) {
|
||||||
if ($include_empty || !$this->_is_cat_empty($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) {
|
if ($unread || !$unread_only) {
|
||||||
array_push($cats, [
|
array_push($cats, [
|
||||||
|
@ -546,7 +546,7 @@ class API extends Handler {
|
||||||
|
|
||||||
if ($cat_id == -4 || $cat_id == -1) {
|
if ($cat_id == -4 || $cat_id == -1) {
|
||||||
foreach ([-1, -2, -3, -4, -6, 0] as $i) {
|
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) {
|
if ($unread || !$unread_only) {
|
||||||
$title = Feeds::_get_title($i);
|
$title = Feeds::_get_title($i);
|
||||||
|
@ -573,7 +573,7 @@ class API extends Handler {
|
||||||
->find_many();
|
->find_many();
|
||||||
|
|
||||||
foreach ($categories as $category) {
|
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);
|
Feeds::_get_cat_children_unread($category->id);
|
||||||
|
|
||||||
if ($unread || !$unread_only) {
|
if ($unread || !$unread_only) {
|
||||||
|
@ -607,7 +607,7 @@ class API extends Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($feeds_obj->find_many() as $feed) {
|
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);
|
$has_icon = Feeds::_has_icon($feed->id);
|
||||||
|
|
||||||
if ($unread || !$unread_only) {
|
if ($unread || !$unread_only) {
|
||||||
|
|
|
@ -250,7 +250,7 @@ class Counters {
|
||||||
|
|
||||||
for ($i = 0; $i >= -4; $i--) {
|
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)
|
if ($i == 0 || $i == -1 || $i == -2)
|
||||||
$auxctr = Feeds::_get_counters($i, false);
|
$auxctr = Feeds::_get_counters($i, false);
|
||||||
|
|
|
@ -1507,7 +1507,7 @@ class Feeds extends Handler_Protected {
|
||||||
$view_query_part = " ";
|
$view_query_part = " ";
|
||||||
} else if ($feed != -1) {
|
} 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)
|
if ($cat_view && $feed > 0 && $include_children)
|
||||||
$unread += self::_get_cat_children_unread($feed);
|
$unread += self::_get_cat_children_unread($feed);
|
||||||
|
|
|
@ -1111,7 +1111,7 @@ class Pref_Feeds extends Handler_Protected {
|
||||||
$title = Feeds::_get_title($feed_id, false);
|
$title = Feeds::_get_title($feed_id, false);
|
||||||
|
|
||||||
if ($unread === false)
|
if ($unread === false)
|
||||||
$unread = Feeds::_get_counters($feed_id, false);
|
$unread = Feeds::_get_counters($feed_id, false, true);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => 'FEED:' . $feed_id,
|
'id' => 'FEED:' . $feed_id,
|
||||||
|
|
Loading…
Reference in New Issue