From 581b81006af157d0fa12b8d1e2604c637234f778 Mon Sep 17 00:00:00 2001 From: Tommaso Ferrari Date: Wed, 22 Oct 2025 12:28:33 -0700 Subject: Add option to apply filter actions to existing articles (#7959) * Add option to apply filter actions to existing articles * make fix-all * Fixes * Another approach with preview New approach: https://github.com/FreshRSS/FreshRSS/pull/7959/commits/20479475c90ac954b991b3703c3cc76c16aa2d5c image Additional improvements: * Also implemented at category level, and at global level * Also implemented for favourites at global level Shortcomings: * Does not always work reliably with advanced regex, since the DB's flavour is not necessarily the same than PHP's Related: https://github.com/FreshRSS/FreshRSS/pull/8141 * make fix-all --------- Co-authored-by: Alexandre Alapetite --- app/Controllers/subscriptionController.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'app/Controllers/subscriptionController.php') diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index ccd421a41..244a16671 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -409,6 +409,30 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { } } + public function viewFilterAction(): void { + $id = Minz_Request::paramInt('id'); + if ($id === 0) { + Minz_Error::error(400); + return; + } + $filteractions = Minz_Request::paramTextToArray('filteractions_read'); + $filteractions = array_map(fn(string $action): string => trim($action), $filteractions); + $filteractions = array_filter($filteractions, fn(string $action): bool => $action !== ''); + $search = "f:$id ("; + foreach ($filteractions as $action) { + $search .= "($action) OR "; + } + $search = preg_replace('/ OR $/', '', $search); + $search .= ')'; + Minz_Request::forward([ + 'c' => 'index', + 'a' => 'index', + 'params' => [ + 'search' => $search, + ], + ], redirect: true); + } + /** * This action displays the bookmarklet page. */ -- cgit v1.2.3