From b4d9a8d54712c5736208f2d018eb68f7f7fad71c Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 6 Sep 2013 10:45:08 -0700 Subject: [PATCH] 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 --- .../conduit/ConduitAPI_feed_query_Method.php | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/applications/feed/conduit/ConduitAPI_feed_query_Method.php b/src/applications/feed/conduit/ConduitAPI_feed_query_Method.php index 51588912b9..261b66d1a1 100644 --- a/src/applications/feed/conduit/ConduitAPI_feed_query_Method.php +++ b/src/applications/feed/conduit/ConduitAPI_feed_query_Method.php @@ -23,16 +23,17 @@ final class ConduitAPI_feed_query_Method 'filterPHIDs' => 'optional list ', 'limit' => 'optional int (default '.$this->getDefaultLimit().')', 'after' => 'optional int', + 'before' => 'optional int', 'view' => 'optional string (data, html, html-summary, text)', ); } private function getSupportedViewTypes() { return array( - 'html' => 'Full HTML presentation of story', - 'data' => 'Dictionary with various data of the story', - 'html-summary' => 'Story contains only the title of the story', - 'text' => 'Simple one-line plain text representation of story', + 'html' => 'Full HTML presentation of story', + 'data' => 'Dictionary with various data of the story', + 'html-summary' => 'Story contains only the title of the story', + 'text' => 'Simple one-line plain text representation of story', ); } @@ -69,13 +70,22 @@ final class ConduitAPI_feed_query_Method if (!$filter_phids) { $filter_phids = array(); } - $after = $request->getValue('after'); $query = id(new PhabricatorFeedQuery()) ->setLimit($limit) ->setFilterPHIDs($filter_phids) - ->setViewer($user) - ->setAfterID($after); + ->setViewer($user); + + $after = $request->getValue('after'); + if (strlen($after)) { + $query->setAfterID($after); + } + + $before = $request->getValue('before'); + if (strlen($before)) { + $query->setBeforeID($before); + } + $stories = $query->execute(); if ($stories) {