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

Keep search and state filters when marking articles as read (#9007)

* Keep search and state filters when marking articles as read

Marking articles as read (e.g. "mark all as read") POSTs to
entry?a=read and, for non-AJAX requests, redirects back to the index.
That redirect rebuilt its parameters without the current `search` and
`state`, so the view fell back to the default state and the active
search was dropped, forcing the user to re-apply their filter.

Carry `search` and `state` through the redirect, mirroring the existing
handling for `order`/`sort`, so the filtered view is preserved.

Fixes #8671

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Reduce comments a bit

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
TowyTowy 23 часов назад
Родитель
Сommit
ad78838ffc
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      app/Controllers/entryController.php

+ 9 - 0
app/Controllers/entryController.php

@@ -202,6 +202,15 @@ class FreshRSS_entry_Controller extends FreshRSS_ActionController {
 		}
 
 		if (!$this->ajax) {
+			// Preserve the active search and read/favourite state filters across the redirect
+			$search = Minz_Request::paramString('search', plaintext: true);
+			if ($search !== '') {
+				$params['search'] = $search;
+			}
+			$stateParam = Minz_Request::paramInt('state');
+			if ($stateParam !== 0) {
+				$params['state'] = $stateParam;
+			}
 			if (FreshRSS_Context::userConf()->sticky_sort) {
 				if (Minz_Request::hasParam('order')) {
 					$params['order'] = Minz_Request::paramString('order', plaintext: true);