mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-05 13:16:14 +01:00
(stable) 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
29b2125e3f
commit
2ffc4be4e7
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