1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

Correct use of the paging API in Phame

Summary: Ref T13266. This callsite is using the older API; swap it to use pagers.

Test Plan: Viewed a Phame blog post with siblings, saw the previous/next posts linked.

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: nicolast

Maniphest Tasks: T13263, T13266

Differential Revision: https://secure.phabricator.com/D20319
This commit is contained in:
epriestley 2019-03-25 07:27:24 -07:00
parent 1d73ae3b50
commit c3563ca156

View file

@ -304,6 +304,15 @@ final class PhamePostViewController
private function loadAdjacentPosts(PhamePost $post) { private function loadAdjacentPosts(PhamePost $post) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$pager = id(new AphrontCursorPagerView())
->setPageSize(1);
$prev_pager = id(clone $pager)
->setAfterID($post->getID());
$next_pager = id(clone $pager)
->setBeforeID($post->getID());
$query = id(new PhamePostQuery()) $query = id(new PhamePostQuery())
->setViewer($viewer) ->setViewer($viewer)
->withVisibility(array(PhameConstants::VISIBILITY_PUBLISHED)) ->withVisibility(array(PhameConstants::VISIBILITY_PUBLISHED))
@ -311,12 +320,10 @@ final class PhamePostViewController
->setLimit(1); ->setLimit(1);
$prev = id(clone $query) $prev = id(clone $query)
->setAfterID($post->getID()) ->executeWithCursorPager($prev_pager);
->execute();
$next = id(clone $query) $next = id(clone $query)
->setBeforeID($post->getID()) ->executeWithCursorPager($next_pager);
->execute();
return array(head($prev), head($next)); return array(head($prev), head($next));
} }