Pārlūkot izejas kodu

Fix archiving (#5935)

fix https://github.com/FreshRSS/FreshRSS/issues/5934
Regression from https://github.com/FreshRSS/FreshRSS/pull/5830
Alexandre Alapetite 2 gadi atpakaļ
vecāks
revīzija
b46ea88c35

+ 9 - 7
app/Controllers/configureController.php

@@ -258,13 +258,15 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController {
 				'keep_period_count' => '3',
 				'keep_period_unit' => 'P1M',
 			];
-		$keepPeriod = FreshRSS_Context::$user_conf->archiving['keep_period'];
-		if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $keepPeriod, $matches)) {
-			$volatile = [
-				'enable_keep_period' => true,
-				'keep_period_count' => $matches['count'],
-				'keep_period_unit' => str_replace($matches['count'], '1', $keepPeriod),
-			];
+		if (!empty(FreshRSS_Context::$user_conf->archiving['keep_period'])) {
+			$keepPeriod = FreshRSS_Context::$user_conf->archiving['keep_period'];
+			if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $keepPeriod, $matches)) {
+				$volatile = [
+					'enable_keep_period' => true,
+					'keep_period_count' => $matches['count'],
+					'keep_period_unit' => str_replace($matches['count'], '1', $keepPeriod),
+				];
+			}
 		}
 		FreshRSS_Context::$user_conf->volatile = $volatile;
 

+ 1 - 1
app/Models/UserConfiguration.php

@@ -3,7 +3,7 @@ declare(strict_types=1);
 
 /**
  * @property string $apiPasswordHash
- * @property array<string,mixed> $archiving
+ * @property array{'keep_period':string|false,'keep_max':int|false,'keep_min':int|false,'keep_favourites':bool,'keep_labels':bool,'keep_unreads':bool} $archiving
  * @property bool $auto_load_more
  * @property bool $auto_remove_article
  * @property bool $bottomline_date