revise behavior of Feeds::_cat_of

This commit is contained in:
Andrew Dolgov 2021-03-02 09:36:44 +03:00
parent f097ae608d
commit 2005a7bf4f
2 changed files with 5 additions and 4 deletions

View File

@ -1842,13 +1842,14 @@ class Feeds extends Handler_Protected {
return $rv; return $rv;
} }
static function _cat_of_feed($feed) { // returns Uncategorized as 0
static function _cat_of($feed) : int {
$feed = ORM::for_table('ttrss_feeds')->find_one($feed); $feed = ORM::for_table('ttrss_feeds')->find_one($feed);
if ($feed) { if ($feed) {
return $feed->cat_id; return (int)$feed->cat_id;
} else { } else {
return false; return -1;
} }
} }

View File

@ -1713,7 +1713,7 @@ class RSSUtils {
$filters = array(); $filters = array();
$feed_id = (int) $feed_id; $feed_id = (int) $feed_id;
$cat_id = (int)Feeds::_cat_of_feed($feed_id); $cat_id = Feeds::_cat_of($feed_id);
if (!$cat_id) if (!$cat_id)
$null_cat_qpart = "cat_id IS NULL OR"; $null_cat_qpart = "cat_id IS NULL OR";