Переглянути джерело

Fix dynamic OPML (#7394)

Regression from https://github.com/FreshRSS/FreshRSS/pull/7155
Fix https://github.com/FreshRSS/FreshRSS/issues/7385
Alexandre Alapetite 1 рік тому
батько
коміт
03aec8b54e
2 змінених файлів з 9 додано та 3 видалено
  1. 6 3
      app/Models/Category.php
  2. 3 0
      app/Services/ImportService.php

+ 6 - 3
app/Models/Category.php

@@ -162,11 +162,14 @@ class FreshRSS_Category extends Minz_Model {
 		if ($this->feeds === null) {
 			$this->feeds = [];
 		}
-		if ($feed->id() !== 0) {
-			$feed->_category($this);
+		$feed->_category($this);
+		if ($feed->id() === 0) {
+			// Feeds created on a dry run do not have an ID
+			$this->feeds[] = $feed;
+		} else {
 			$this->feeds[$feed->id()] = $feed;
-			$this->sortFeeds();
 		}
+		$this->sortFeeds();
 	}
 
 	/**

+ 3 - 0
app/Services/ImportService.php

@@ -312,6 +312,9 @@ class FreshRSS_Import_Service {
 			$feed = Minz_ExtensionManager::callHook('feed_before_insert', $feed);
 
 			if ($dry_run) {
+				if ($feed !== null) {
+					$category->addFeed($feed);
+				}
 				return $feed;
 			}