1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 02:32: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) {
$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())
->setViewer($viewer)
->withVisibility(array(PhameConstants::VISIBILITY_PUBLISHED))
@ -311,12 +320,10 @@ final class PhamePostViewController
->setLimit(1);
$prev = id(clone $query)
->setAfterID($post->getID())
->execute();
->executeWithCursorPager($prev_pager);
$next = id(clone $query)
->setBeforeID($post->getID())
->execute();
->executeWithCursorPager($next_pager);
return array(head($prev), head($next));
}