From a1cbbc3587121403dabdbfb86d167716e135a689 Mon Sep 17 00:00:00 2001 From: Floorb <132411956+Neetpone@users.noreply.github.com> Date: Fri, 19 May 2023 06:31:20 -0400 Subject: [PATCH] fix: make untagged search work for no-js view too --- public/archive.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/public/archive.php b/public/archive.php index 60fe393..b0e57b1 100644 --- a/public/archive.php +++ b/public/archive.php @@ -35,10 +35,14 @@ $pastes = Paste::with([ if (!empty($filter_value)) { - $pastes = $pastes->where('title', 'LIKE', '%' . escapeLikeQuery($filter_value) . '%') - ->orWhereHas('tags', function($q) use ($filter_value) { - $q->where('name', 'LIKE', '%' . escapeLikeQuery($filter_value) . '%'); - }); + if ($filter_value === 'untagged') { + $pastes = $pastes->doesntHave('tags'); + } else { + $pastes = $pastes->where('title', 'LIKE', '%' . escapeLikeQuery($filter_value) . '%') + ->orWhereHas('tags', function($q) use ($filter_value) { + $q->where('name', 'LIKE', '%' . escapeLikeQuery($filter_value) . '%'); + }); + } } $total_results = $pastes->count();