From c9a00fcb1cc96c5b9ff7da413759a6550f99aea0 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 20 Apr 2021 20:51:09 +0000 Subject: [PATCH] Issue 10156: Fix endless scroll with filed posts Fixes #10156 --- src/Module/Search/Filed.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Module/Search/Filed.php b/src/Module/Search/Filed.php index f14c29aa3d..d62c3feb20 100644 --- a/src/Module/Search/Filed.php +++ b/src/Module/Search/Filed.php @@ -47,16 +47,23 @@ class Filed extends BaseSearch DI::config()->get('system', 'itemspage_network')); } + $last_uriid = isset($_GET['last_uriid']) ? intval($_GET['last_uriid']) : 0; + $pager = new Pager(DI::l10n(), DI::args()->getQueryString(), $itemspage_network); $term_condition = ['type' => Category::FILE, 'uid' => local_user()]; if ($file) { $term_condition['name'] = $file; } + + if (!empty($last_uriid)) { + $term_condition = DBA::mergeConditions($term_condition, ["`uri-id` < ?", $last_uriid]); + } + $term_params = ['order' => ['uri-id' => true], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]]; $result = DBA::select('category-view', ['uri-id'], $term_condition, $term_params); - $total = DBA::count('category-view', $term_condition); + $count = DBA::count('category-view', $term_condition); $posts = []; while ($term = DBA::fetch($result)) { @@ -77,7 +84,7 @@ class Filed extends BaseSearch if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) { $o .= HTML::scrollLoader(); } else { - $o .= $pager->renderFull($total); + $o .= $pager->renderMinimal($count); } return $o;