Просмотр исходного кода

Keep the errors filter after removing a feed (#9656)

Fix #9654

When the subscription page shows only the feeds with errors and a feed is removed from its slider, the redirect went back to the full list. The remove button now keeps `error=1`, and `feed/delete` redirects to the subscription page with `error=1` in that case.

Without `error`, the redirect is unchanged.

How this was checked: I ran FreshRSS 1.31 edge with the PHP built-in server and SQLite, with one feed in error. Before the change, `POST feed/delete` from the error-filtered slider redirected to `?c=subscription`. After the change, it redirects to `?c=subscription&error=1`. Without the error filter, it still redirects to `?c=subscription`. I did not add a PHPUnit test because the action ends in a redirect, and I did not run `make test-all`.
fuyoacademy 19 часов назад
Родитель
Сommit
cb522a8dbf
2 измененных файлов с 10 добавлено и 4 удалено
  1. 3 0
      app/Controllers/feedController.php
  2. 7 4
      app/views/helpers/feed/update.phtml

+ 3 - 0
app/Controllers/feedController.php

@@ -1186,6 +1186,9 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
 				break;
 			default:
 				$redirect_url = ['c' => 'subscription', 'a' => 'index'];
+				if (Minz_Request::paramBoolean('error')) {
+					$redirect_url['params'] = ['error' => 1];
+				}
 				if (!Minz_Request::isPost()) {
 					Minz_Request::forward($redirect_url, true);
 				}

+ 7 - 4
app/views/helpers/feed/update.phtml

@@ -294,11 +294,14 @@
 					<button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
 					<button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
 					<?php
-					if ($from === '') {
-						$url = _url('feed', 'delete', 'id', $this->feed->id());
-					} else {
-						$url = _url('feed', 'delete', 'id', $this->feed->id(), 'from', $from);
+					$deleteParams = ['id', $this->feed->id()];
+					if ($from !== '') {
+						array_push($deleteParams, 'from', $from);
 					}
+					if (Minz_Request::paramBoolean('error')) {
+						array_push($deleteParams, 'error', 1);
+					}
+					$url = _url('feed', 'delete', ...$deleteParams);
 					?>
 					<button type="submit" class="btn btn-attention confirm"
 						data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"