mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Fix "before/after" cursor paging for API call "feed.query"
Summary: Ref T13266. See <https://discourse.phabricator-community.org/t/undefined-method-setafterid-when-calling-feed-query/2653>. This older API call needs an update to the newer paging/cursor API. Test Plan: Called `feed.query` with an "after" parameter. Reviewers: amckinley Reviewed By: amckinley Subscribers: Itms Maniphest Tasks: T13266 Differential Revision: https://secure.phabricator.com/D20456
This commit is contained in:
parent
a4a1143b18
commit
b0b8926c75
1 changed files with 11 additions and 9 deletions
|
@ -63,13 +63,7 @@ final class FeedQueryConduitAPIMethod extends FeedConduitAPIMethod {
|
|||
$view_type = 'data';
|
||||
}
|
||||
|
||||
$limit = $request->getValue('limit');
|
||||
if (!$limit) {
|
||||
$limit = $this->getDefaultLimit();
|
||||
}
|
||||
|
||||
$query = id(new PhabricatorFeedQuery())
|
||||
->setLimit($limit)
|
||||
->setViewer($user);
|
||||
|
||||
$filter_phids = $request->getValue('filterPHIDs');
|
||||
|
@ -77,17 +71,25 @@ final class FeedQueryConduitAPIMethod extends FeedConduitAPIMethod {
|
|||
$query->withFilterPHIDs($filter_phids);
|
||||
}
|
||||
|
||||
$limit = $request->getValue('limit');
|
||||
if (!$limit) {
|
||||
$limit = $this->getDefaultLimit();
|
||||
}
|
||||
|
||||
$pager = id(new AphrontCursorPagerView())
|
||||
->setPageSize($limit);
|
||||
|
||||
$after = $request->getValue('after');
|
||||
if (strlen($after)) {
|
||||
$query->setAfterID($after);
|
||||
$pager->setAfterID($after);
|
||||
}
|
||||
|
||||
$before = $request->getValue('before');
|
||||
if (strlen($before)) {
|
||||
$query->setBeforeID($before);
|
||||
$pager->setBeforeID($before);
|
||||
}
|
||||
|
||||
$stories = $query->execute();
|
||||
$stories = $query->executeWithCursorPager($pager);
|
||||
|
||||
if ($stories) {
|
||||
foreach ($stories as $story) {
|
||||
|
|
Loading…
Reference in a new issue