1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Fix issue when paging Applications

Summary: See <https://github.com/facebook/phabricator/issues/450>.

Test Plan: See GitHub issue.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7627
This commit is contained in:
epriestley 2013-11-22 12:34:52 -08:00
parent 4910a36563
commit 97937556ca
2 changed files with 15 additions and 1 deletions

View file

@ -198,7 +198,16 @@ final class PhabricatorApplicationSearchController
$pager = new AphrontCursorPagerView(); $pager = new AphrontCursorPagerView();
$pager->readFromRequest($request); $pager->readFromRequest($request);
$pager->setPageSize($engine->getPageSize($saved_query)); $page_size = $engine->getPageSize($saved_query);
if (is_finite($page_size)) {
$pager->setPageSize($page_size);
} else {
// Consider an INF pagesize to mean a large finite pagesize.
// TODO: It would be nice to handle this more gracefully, but math
// with INF seems to vary across PHP versions, systems, and runtimes.
$pager->setPageSize(0xFFFF);
}
$objects = $query->setViewer($request->getUser()) $objects = $query->setViewer($request->getUser())
->executeWithCursorPager($pager); ->executeWithCursorPager($pager);

View file

@ -19,6 +19,11 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
} }
protected function getPagingValue($result) { protected function getPagingValue($result) {
if (!is_object($result)) {
// This interface can't be typehinted and PHP gets really angry if we
// call a method on a non-object, so add an explicit check here.
throw new Exception(pht('Expected object, got "%s"!', gettype($result)));
}
return $result->getID(); return $result->getID();
} }