Move $pager and $page_offset out of App

- Move infinite scroll data output in a module hook
- Use Pager instead of paginate() and alt_pager()
This commit is contained in:
Hypolite Petovan 2018-10-24 02:15:24 -04:00
parent a976a4cb68
commit 14237a9599
29 changed files with 234 additions and 385 deletions

View file

@ -5,6 +5,7 @@
namespace Friendica\Model;
use Friendica\BaseObject;
use Friendica\Content\Pager;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
@ -1345,25 +1346,27 @@ class Contact extends BaseObject
$cid, GRAVITY_PARENT, GRAVITY_COMMENT, local_user()];
}
$pager = new Pager($a->query_string);
$params = ['order' => ['created' => true],
'limit' => [$a->pager['start'], $a->pager['itemspage']]];
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
if ($thread_mode) {
$r = Item::selectThreadForUser(local_user(), ['uri'], $condition, $params);
$items = Item::inArray($r);
$o = conversation($a, $items, 'contacts', $update);
$o = conversation($a, $items, $pager, 'contacts', $update);
} else {
$r = Item::selectForUser(local_user(), [], $condition, $params);
$items = Item::inArray($r);
$o = conversation($a, $items, 'contact-posts', false);
$o = conversation($a, $items, $pager, 'contact-posts', false);
}
if (!$update) {
$o .= alt_pager($a, count($items));
$o .= $pager->renderMinimal(count($items));
}
return $o;