From 815b97017be7bcfe878058bedc7776992dc7c8f6 Mon Sep 17 00:00:00 2001 From: Inverle Date: Wed, 18 Mar 2026 00:10:53 +0100 Subject: [PATCH] Improve consistency of slider behavior after submitting form (#8612) Closes https://github.com/FreshRSS/FreshRSS/issues/8529 * Preserve `error` parameter after submitting form in subscription management --- app/Controllers/categoryController.php | 4 +- app/Controllers/configureController.php | 2 +- app/Controllers/indexController.php | 15 ++-- app/Controllers/subscriptionController.php | 9 ++- app/Controllers/tagController.php | 14 +++- app/Models/View.php | 1 + app/layout/aside_feed.phtml | 2 +- app/views/helpers/category/update.phtml | 14 +++- app/views/helpers/configure/query.phtml | 4 +- app/views/helpers/feed/update.phtml | 14 +++- app/views/helpers/tag/update.phtml | 73 ++++++++++++++++++++ app/views/index/normal.phtml | 10 +++ app/views/index/reader.phtml | 10 +++ app/views/subscription/index.phtml | 2 +- app/views/tag/index.phtml | 2 +- app/views/tag/update.phtml | 79 +++------------------- p/themes/base-theme/frss.css | 1 + p/themes/base-theme/frss.rtl.css | 1 + 18 files changed, 169 insertions(+), 88 deletions(-) create mode 100644 app/views/helpers/tag/update.phtml diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index ffd6e68b8..eca768050 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -174,7 +174,9 @@ class FreshRSS_category_Controller extends FreshRSS_ActionController { invalidateHttpCache(); - $url_redirect = ['c' => 'subscription', 'params' => ['id' => $id, 'type' => 'category']]; + $from = Minz_Request::paramString('from'); + $prev_controller = $from === 'update' ? 'category' : 'subscription'; + $url_redirect = ['c' => $prev_controller, 'a' => $from, 'params' => ['id' => $id, 'type' => 'category']]; if (false !== $categoryDAO->updateCategory($id, $values)) { Minz_Request::good( _t('feedback.sub.category.updated'), diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 343ec9c03..960e429a6 100644 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -542,7 +542,7 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController { Minz_Request::good( _t('feedback.conf.updated'), - [ 'c' => 'configure', 'a' => 'queries', 'params' => ['id' => (string)$id] ], + [ 'c' => 'configure', 'a' => Minz_Request::paramStringNull('from') ?? 'queries', 'params' => ['id' => (string)$id] ], showNotification: FreshRSS_Context::userConf()->good_notification_timeout > 0); } diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 36fd1c9b2..64666f784 100644 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -111,10 +111,17 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController { $id = Minz_Request::paramInt('id'); if ($id !== 0) { - $view = Minz_Request::paramString('a'); - $url_redirect = ['c' => 'subscription', 'a' => 'feed', 'params' => ['id' => (string)$id, 'from' => $view]]; - Minz_Request::forward($url_redirect, true); - return; + if (Minz_Request::paramString('type') === 'tag') { + $tagDAO = FreshRSS_Factory::createTagDao(); + $tag = $tagDAO->searchById($id); + $this->view->tag = $tag; + } else { + $feedDAO = FreshRSS_Factory::createFeedDao(); + $feed = $feedDAO->searchById($id); + $this->view->feed = $feed; + } + $this->view->displaySlider = true; + $this->view->cfrom = Minz_Request::actionName(); } try { diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index be2dc5f70..89aca97b9 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -375,13 +375,16 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { case 'reader': $get = Minz_Request::paramString('get'); if ($get !== '') { - $url_redirect = ['c' => 'index', 'a' => $from, 'params' => ['get' => $get]]; + $url_redirect = ['c' => 'index', 'a' => $from, 'params' => ['id' => $id, 'get' => $get]]; } else { - $url_redirect = ['c' => 'index', 'a' => $from]; + $url_redirect = ['c' => 'index', 'a' => $from, 'params' => ['id' => $id]]; } break; + case 'index': + $url_redirect = ['c' => 'subscription', 'params' => ['id' => $id, 'error' => Minz_Request::paramBoolean('error') ? 1 : 0]]; + break; default: - $url_redirect = ['c' => 'subscription', 'params' => ['id' => $id]]; + $url_redirect = ['c' => 'subscription', 'a' => 'feed', 'params' => ['id' => $id]]; } if ($favicon_uploaded && !$resetFavicon) { diff --git a/app/Controllers/tagController.php b/app/Controllers/tagController.php index 58018094c..019a44b0c 100644 --- a/app/Controllers/tagController.php +++ b/app/Controllers/tagController.php @@ -124,7 +124,14 @@ class FreshRSS_tag_Controller extends FreshRSS_ActionController { invalidateHttpCache(); - $url_redirect = ['c' => 'tag', 'a' => 'update', 'params' => ['id' => $id]]; + $prev_controller = 'tag'; + $from = Minz_Request::paramStringNull('from') ?? 'update'; + $params = ['id' => $id]; + if ($from === 'normal' || $from === 'reader') { + $prev_controller = 'index'; + $params['type'] = 'tag'; + } + $url_redirect = ['c' => $prev_controller, 'a' => $from, 'params' => $params]; if ($ok) { Minz_Request::good( _t('feedback.tag.updated'), @@ -225,6 +232,11 @@ class FreshRSS_tag_Controller extends FreshRSS_ActionController { } $tagDAO = FreshRSS_Factory::createTagDao(); $this->view->tags = $tagDAO->listTags(precounts: true); + $id = Minz_Request::paramInt('id'); + if ($id !== 0) { + $this->view->displaySlider = true; + $this->view->tag = $tagDAO->searchById($id); + } } public static function escapeForSearch(string $tag): string { diff --git a/app/Models/View.php b/app/Models/View.php index fa1b2760a..5990a41b8 100644 --- a/app/Models/View.php +++ b/app/Models/View.php @@ -38,6 +38,7 @@ class FreshRSS_View extends Minz_View { public array $labels; // Subscriptions + public string $cfrom = ''; public bool $displaySlider = false; public bool $load_ok; public bool $onlyFeedsWithError; diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index d3a39a00c..90d8692d9 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -173,7 +173,7 @@