From 8aff756e30ef544a660d0106c262d4797b57c6fe Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 18 Nov 2023 09:27:33 +0200 Subject: [PATCH] apply search filter for RSS #35 --- src/Controller/TorrentController.php | 16 ++++++++-------- templates/default/torrent/list.html.twig | 24 +++++++++++++++++------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/Controller/TorrentController.php b/src/Controller/TorrentController.php index 0da8c26..38205db 100644 --- a/src/Controller/TorrentController.php +++ b/src/Controller/TorrentController.php @@ -632,11 +632,11 @@ class TorrentController extends AbstractController // Get total torrents $total = $torrentService->findTorrentsTotal( - $user->getId(), + $request->get('filter') ? 0 : $user->getId(), $query, - $user->getLocales(), - $user->getCategories(), - $user->isSensitive() ? false : null, + $request->get('filter') ? (array) $request->get('locales') : $user->getLocales(), + $request->get('filter') ? (array) $request->get('categories') : $user->getCategories(), + $request->get('filter') ? ($request->get('sensitive') ? null : false) : ($user->isSensitive() ? false : null), !$user->isModerator() ? true : null, !$user->isModerator() ? true : null, ); @@ -644,11 +644,11 @@ class TorrentController extends AbstractController // Create torrents list $torrents = []; foreach ($torrentService->findTorrents( - $user->getId(), + $request->get('filter') ? 0 : $user->getId(), $query, - $user->getLocales(), - $user->getCategories(), - $user->isSensitive() ? false : null, + $request->get('filter') ? (array) $request->get('locales') : $user->getLocales(), + $request->get('filter') ? (array) $request->get('categories') : $user->getCategories(), + $request->get('filter') ? ($request->get('sensitive') ? null : false) : ($user->isSensitive() ? false : null), !$user->isModerator() ? true : null, !$user->isModerator() ? true : null, $this->getParameter('app.pagination'), diff --git a/templates/default/torrent/list.html.twig b/templates/default/torrent/list.html.twig index 941b1c9..10187cb 100644 --- a/templates/default/torrent/list.html.twig +++ b/templates/default/torrent/list.html.twig @@ -11,18 +11,27 @@ + + + + + {% else %} + + + + + {% endif %} - - - - - {% else %}

{{ 'Recent uploads' | trans }}

@@ -186,7 +195,7 @@ {% if query %} {% if pagination.page > 1 %} {% if pagination.page == 2 %} -