Fix paging for 'before ID' queries
Test Plan: https://secure.phabricator.com/paste/filter/all/?before=157 - 158 is missing. Reviewers: epriestley Reviewed By: epriestley CC: aran, Koolvin Differential Revision: https://secure.phabricator.com/D2330
This commit is contained in:
@@ -87,7 +87,8 @@ final class AphrontIDPagerView extends AphrontView {
|
|||||||
|
|
||||||
final public function sliceResults(array $results) {
|
final public function sliceResults(array $results) {
|
||||||
if (count($results) > $this->getPageSize()) {
|
if (count($results) > $this->getPageSize()) {
|
||||||
$results = array_slice($results, 0, $this->getPageSize(), true);
|
$offset = ($this->beforeID ? count($results) - $this->getPageSize() : 0);
|
||||||
|
$results = array_slice($results, $offset, $this->getPageSize(), true);
|
||||||
}
|
}
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user