diff options
author | Yorhel <git@yorhel.nl> | 2021-01-09 16:44:13 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2021-01-09 16:44:13 +0100 |
commit | 5d275ce2ceb1112c1e02bbe9134b22ac478975fc (patch) | |
tree | 11d3fb560bee52af8f4ab7c2cac73bce6f04799c /lib/VNWeb/Misc/Redirects.pm | |
parent | 1ec958ba9d2e40c65246bd29f28b2b50364b2a5a (diff) |
AdvSearch: Apply new saved default queries to listings instead of old filters
Diffstat (limited to 'lib/VNWeb/Misc/Redirects.pm')
-rw-r--r-- | lib/VNWeb/Misc/Redirects.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/VNWeb/Misc/Redirects.pm b/lib/VNWeb/Misc/Redirects.pm index 964c4e24..4a84150b 100644 --- a/lib/VNWeb/Misc/Redirects.pm +++ b/lib/VNWeb/Misc/Redirects.pm @@ -1,7 +1,7 @@ package VNWeb::Misc::Redirects; use VNWeb::Prelude; -use VNWeb::Filters; +use VNWeb::AdvSearch; # VNDB URLs don't have a trailing /, redirect if we get one. @@ -28,11 +28,11 @@ TUWF::get qr{/v/rand}, sub { state $stats ||= tuwf->dbRowi('SELECT COUNT(*) AS total, COUNT(*) FILTER(WHERE NOT hidden) AS subset FROM vn'); state $sample ||= 100*min 1, (100 / $stats->{subset}) * ($stats->{total} / $stats->{subset}); - my $filt = auth->pref('filter_vn') && eval { filter_parse v => auth->pref('filter_vn') }; + my $filt = advsearch_default 'v'; my $vn = tuwf->dbVali(' SELECT id - FROM vn v', $filt ? '' : ('TABLESAMPLE SYSTEM (', \$sample, ')'), ' - WHERE NOT hidden AND', filter_vn_query($filt||{}), ' + FROM vn v', $filt->{query} ? '' : ('TABLESAMPLE SYSTEM (', \$sample, ')'), ' + WHERE NOT hidden AND', $filt->sql_where(), ' ORDER BY random() LIMIT 1' ); return tuwf->resNotFound if !$vn; |