Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15416396
D9014.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D9014.diff
View Options
diff --git a/src/applications/countdown/controller/PhabricatorCountdownListController.php b/src/applications/countdown/controller/PhabricatorCountdownListController.php
--- a/src/applications/countdown/controller/PhabricatorCountdownListController.php
+++ b/src/applications/countdown/controller/PhabricatorCountdownListController.php
@@ -1,8 +1,7 @@
<?php
final class PhabricatorCountdownListController
- extends PhabricatorCountdownController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+ extends PhabricatorCountdownController {
private $queryKey;
@@ -24,46 +23,5 @@
return $this->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
--- 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 @@
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;
+ }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 21, 10:52 AM (2 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7591231
Default Alt Text
D9014.diff (3 KB)
Attached To
Mode
D9014: Move Countdown rendering to SearchEngine
Attached
Detach File
Event Timeline
Log In to Comment