diff --git a/src/applications/countdown/controller/PhabricatorCountdownListController.php b/src/applications/countdown/controller/PhabricatorCountdownListController.php index 549b6a8705..2085a6884f 100644 --- a/src/applications/countdown/controller/PhabricatorCountdownListController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownListController.php @@ -1,8 +1,7 @@ delegateToController($controller); } - public function renderResultsList( - array $countdowns, - PhabricatorSavedQuery $query) { - assert_instances_of($countdowns, 'PhabricatorCountdown'); - - $viewer = $this->getRequest()->getUser(); - - $this->loadHandles(mpull($countdowns, 'getAuthorPHID')); - - - $list = new PHUIObjectItemListView(); - $list->setUser($viewer); - foreach ($countdowns as $countdown) { - $id = $countdown->getID(); - - $item = id(new PHUIObjectItemView()) - ->setObjectName("C{$id}") - ->setHeader($countdown->getTitle()) - ->setHref($this->getApplicationURI("{$id}/")) - ->addByline( - pht( - 'Created by %s', - $this->getHandle($countdown->getAuthorPHID())->renderLink())); - - $epoch = $countdown->getEpoch(); - if ($epoch >= time()) { - $item->addIcon( - 'none', - pht('Ends %s', phabricator_datetime($epoch, $viewer))); - } else { - $item->addIcon( - 'delete', - pht('Ended %s', phabricator_datetime($epoch, $viewer))); - $item->setDisabled(true); - } - - $list->addItem($item); - } - - return $list; - } } diff --git a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php index ca843e2c2b..427485401f 100644 --- a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php +++ b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorCountdownSearchEngine extends PhabricatorApplicationSearchEngine { + public function getApplicationClassName() { + return 'PhabricatorApplicationCountdown'; + } + public function buildSavedQueryFromRequest(AphrontRequest $request) { $saved = new PhabricatorSavedQuery(); $saved->setParameter( @@ -93,4 +97,50 @@ final class PhabricatorCountdownSearchEngine return parent::buildSavedQueryFromBuiltin($query_key); } + + protected function getRequiredHandlePHIDsForResultList( + array $countdowns, + PhabricatorSavedQuery $query) { + return mpull($countdowns, 'getAuthorPHID'); + } + + protected function renderResultList( + array $countdowns, + PhabricatorSavedQuery $query, + array $handles) { + assert_instances_of($countdowns, 'PhabricatorCountdown'); + + $viewer = $this->requireViewer(); + + $list = new PHUIObjectItemListView(); + $list->setUser($viewer); + foreach ($countdowns as $countdown) { + $id = $countdown->getID(); + + $item = id(new PHUIObjectItemView()) + ->setObjectName("C{$id}") + ->setHeader($countdown->getTitle()) + ->setHref($this->getApplicationURI("{$id}/")) + ->addByline( + pht( + 'Created by %s', + $handles[$countdown->getAuthorPHID()]->renderLink())); + + $epoch = $countdown->getEpoch(); + if ($epoch >= time()) { + $item->addIcon( + 'none', + pht('Ends %s', phabricator_datetime($epoch, $viewer))); + } else { + $item->addIcon( + 'delete', + pht('Ended %s', phabricator_datetime($epoch, $viewer))); + $item->setDisabled(true); + } + + $list->addItem($item); + } + + return $list; + } }