diff options
| author | 2023-12-27 15:18:36 +0100 | |
|---|---|---|
| committer | 2023-12-27 15:18:36 +0100 | |
| commit | d65f77c081e756997e59e602f49eeea9b09799ff (patch) | |
| tree | 0094569a28b089a90ce146ee3782cfbff4fc0be9 /app/Models | |
| parent | e9689645383d37231afa9dbbcd9bd765b804046d (diff) | |
More robust assignment of categories to feeds (#5986)
Several minor cases, none of which should really be necessary
Might help:
https://github.com/FreshRSS/FreshRSS/issues/5981
https://github.com/FreshRSS/FreshRSS/issues/5982
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/Category.php | 3 | ||||
| -rw-r--r-- | app/Models/CategoryDAO.php | 1 | ||||
| -rw-r--r-- | app/Models/Context.php | 4 |
3 files changed, 5 insertions, 3 deletions
diff --git a/app/Models/Category.php b/app/Models/Category.php index cc25a1ec0..49ef2d283 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -153,6 +153,7 @@ class FreshRSS_Category extends Minz_Model { if ($this->feeds === null) { $this->feeds = []; } + $feed->_category($this); $this->feeds[] = $feed; $this->sortFeeds(); @@ -210,7 +211,7 @@ class FreshRSS_Category extends Minz_Model { foreach ($dryRunCategory->feeds() as $dryRunFeed) { if (empty($existingFeeds[$dryRunFeed->url()])) { // The feed does not exist in the current category, so add that feed - $dryRunFeed->_categoryId($this->id()); + $dryRunFeed->_category($this); $ok &= ($feedDAO->addFeedObject($dryRunFeed) !== false); } else { $existingFeed = $existingFeeds[$dryRunFeed->url()]; diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index 417ff7a6c..a22cda420 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -401,6 +401,7 @@ SQL; foreach ($categories as $category) { foreach ($category->feeds() as $feed) { if ($feed->id() === $feed_id) { + $feed->_category($category); // Should already be done; just to be safe return $feed; } } diff --git a/app/Models/Context.php b/app/Models/Context.php index 3ea5a29eb..bb6fa4cbd 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -362,7 +362,7 @@ final class FreshRSS_Context { if (empty(self::$categories)) { $catDAO = FreshRSS_Factory::createCategoryDao(); - self::$categories = $catDAO->listCategories(); + self::$categories = $catDAO->listCategories(true); } switch($type) { @@ -458,7 +458,7 @@ final class FreshRSS_Context { if (empty(self::$categories)) { $catDAO = FreshRSS_Factory::createCategoryDao(); - self::$categories = $catDAO->listCategories(); + self::$categories = $catDAO->listCategories(true); } if (FreshRSS_Context::userConf()->onread_jump_next && strlen($get) > 2) { |
