mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-11 07:11:04 +01:00
Add a "before" parameter to feed.query
Summary: See IRC. We already have "after", add the corresponding "before". This makes polling for updates much easier. Test Plan: Ran queries with "before" and "after". Reviewers: chad, btrahan Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D6903
This commit is contained in:
parent
78cbfc3a02
commit
b4d9a8d547
1 changed files with 17 additions and 7 deletions
|
@ -23,16 +23,17 @@ final class ConduitAPI_feed_query_Method
|
||||||
'filterPHIDs' => 'optional list <phid>',
|
'filterPHIDs' => 'optional list <phid>',
|
||||||
'limit' => 'optional int (default '.$this->getDefaultLimit().')',
|
'limit' => 'optional int (default '.$this->getDefaultLimit().')',
|
||||||
'after' => 'optional int',
|
'after' => 'optional int',
|
||||||
|
'before' => 'optional int',
|
||||||
'view' => 'optional string (data, html, html-summary, text)',
|
'view' => 'optional string (data, html, html-summary, text)',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSupportedViewTypes() {
|
private function getSupportedViewTypes() {
|
||||||
return array(
|
return array(
|
||||||
'html' => 'Full HTML presentation of story',
|
'html' => 'Full HTML presentation of story',
|
||||||
'data' => 'Dictionary with various data of the story',
|
'data' => 'Dictionary with various data of the story',
|
||||||
'html-summary' => 'Story contains only the title of the story',
|
'html-summary' => 'Story contains only the title of the story',
|
||||||
'text' => 'Simple one-line plain text representation of story',
|
'text' => 'Simple one-line plain text representation of story',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,13 +70,22 @@ final class ConduitAPI_feed_query_Method
|
||||||
if (!$filter_phids) {
|
if (!$filter_phids) {
|
||||||
$filter_phids = array();
|
$filter_phids = array();
|
||||||
}
|
}
|
||||||
$after = $request->getValue('after');
|
|
||||||
|
|
||||||
$query = id(new PhabricatorFeedQuery())
|
$query = id(new PhabricatorFeedQuery())
|
||||||
->setLimit($limit)
|
->setLimit($limit)
|
||||||
->setFilterPHIDs($filter_phids)
|
->setFilterPHIDs($filter_phids)
|
||||||
->setViewer($user)
|
->setViewer($user);
|
||||||
->setAfterID($after);
|
|
||||||
|
$after = $request->getValue('after');
|
||||||
|
if (strlen($after)) {
|
||||||
|
$query->setAfterID($after);
|
||||||
|
}
|
||||||
|
|
||||||
|
$before = $request->getValue('before');
|
||||||
|
if (strlen($before)) {
|
||||||
|
$query->setBeforeID($before);
|
||||||
|
}
|
||||||
|
|
||||||
$stories = $query->execute();
|
$stories = $query->execute();
|
||||||
|
|
||||||
if ($stories) {
|
if ($stories) {
|
||||||
|
|
Loading…
Reference in a new issue