Page MenuHomePhabricator

D9010.diff
No OneTemporary

D9010.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -5066,11 +5066,7 @@
'PhabricatorSlowvoteDAO' => 'PhabricatorLiskDAO',
'PhabricatorSlowvoteEditController' => 'PhabricatorSlowvoteController',
'PhabricatorSlowvoteEditor' => 'PhabricatorApplicationTransactionEditor',
- 'PhabricatorSlowvoteListController' =>
- array(
- 0 => 'PhabricatorSlowvoteController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'PhabricatorSlowvoteListController' => 'PhabricatorSlowvoteController',
'PhabricatorSlowvoteOption' => 'PhabricatorSlowvoteDAO',
'PhabricatorSlowvotePHIDTypePoll' => 'PhabricatorPHIDType',
'PhabricatorSlowvotePoll' =>
diff --git a/src/applications/feed/query/PhabricatorFeedSearchEngine.php b/src/applications/feed/query/PhabricatorFeedSearchEngine.php
--- a/src/applications/feed/query/PhabricatorFeedSearchEngine.php
+++ b/src/applications/feed/query/PhabricatorFeedSearchEngine.php
@@ -124,9 +124,10 @@
return parent::buildSavedQueryFromBuiltin($query_key);
}
- public function renderResults(
+ public function renderResultList(
array $objects,
- PhabricatorSavedQuery $query) {
+ PhabricatorSavedQuery $query,
+ array $handles) {
$builder = new PhabricatorFeedBuilder($objects);
$builder->setShowHovercards(true);
diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
--- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
+++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
@@ -561,6 +561,31 @@
public function renderResults(
array $objects,
PhabricatorSavedQuery $query) {
+
+ $phids = $this->getRequiredHandlePHIDsForResultList($objects, $query);
+
+ if ($phids) {
+ $handles = id(new PhabricatorHandleQuery())
+ ->setViewer($this->requireViewer())
+ ->witHPHIDs($phids)
+ ->execute();
+ } else {
+ $handles = array();
+ }
+
+ return $this->renderResultList($objects, $query, $handles);
+ }
+
+ public function getRequiredHandlePHIDsForResultList(
+ array $objects,
+ PhabricatorSavedQuery $query) {
+ return array();
+ }
+
+ public function renderResultList(
+ array $objects,
+ PhabricatorSavedQuery $query,
+ array $handles) {
throw new Exception(pht('Not supported here yet!'));
}
diff --git a/src/applications/slowvote/controller/PhabricatorSlowvoteListController.php b/src/applications/slowvote/controller/PhabricatorSlowvoteListController.php
--- a/src/applications/slowvote/controller/PhabricatorSlowvoteListController.php
+++ b/src/applications/slowvote/controller/PhabricatorSlowvoteListController.php
@@ -1,11 +1,7 @@
<?php
-/**
- * @group slowvote
- */
final class PhabricatorSlowvoteListController
- extends PhabricatorSlowvoteController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+ extends PhabricatorSlowvoteController {
private $queryKey;
@@ -27,46 +23,4 @@
return $this->delegateToController($controller);
}
- public function renderResultsList(
- array $polls,
- PhabricatorSavedQuery $query) {
- assert_instances_of($polls, 'PhabricatorSlowvotePoll');
- $viewer = $this->getRequest()->getUser();
-
- $list = id(new PHUIObjectItemListView())
- ->setUser($viewer);
-
- $phids = mpull($polls, 'getAuthorPHID');
- $handles = $this->loadViewerHandles($phids);
-
- foreach ($polls as $poll) {
- $date_created = phabricator_datetime($poll->getDateCreated(), $viewer);
- if ($poll->getAuthorPHID()) {
- $author = $handles[$poll->getAuthorPHID()]->renderLink();
- } else {
- $author = null;
- }
-
- $item = id(new PHUIObjectItemView())
- ->setObjectName('V'.$poll->getID())
- ->setHeader($poll->getQuestion())
- ->setHref('/V'.$poll->getID())
- ->setDisabled($poll->getIsClosed())
- ->addIcon('none', $date_created);
-
- $description = $poll->getDescription();
- if (strlen($description)) {
- $item->addAttribute(phutil_utf8_shorten($poll->getDescription(), 120));
- }
-
- if ($author) {
- $item->addByline(pht('Author: %s', $author));
- }
-
- $list->addItem($item);
- }
-
- return $list;
- }
-
}
diff --git a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php
--- a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php
+++ b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php
@@ -115,4 +115,53 @@
return parent::buildSavedQueryFromBuiltin($query_key);
}
+ public function getRequiredHandlePHIDsForResultList(
+ array $polls,
+ PhabricatorSavedQuery $query) {
+ return mpull($polls, 'getAuthorPHID');
+ }
+
+ public function renderResultList(
+ array $polls,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+
+ assert_instances_of($polls, 'PhabricatorSlowvotePoll');
+ $viewer = $this->requireViewer();
+
+ $list = id(new PHUIObjectItemListView())
+ ->setUser($viewer);
+
+ $phids = mpull($polls, 'getAuthorPHID');
+
+ foreach ($polls as $poll) {
+ $date_created = phabricator_datetime($poll->getDateCreated(), $viewer);
+ if ($poll->getAuthorPHID()) {
+ $author = $handles[$poll->getAuthorPHID()]->renderLink();
+ } else {
+ $author = null;
+ }
+
+ $item = id(new PHUIObjectItemView())
+ ->setObjectName('V'.$poll->getID())
+ ->setHeader($poll->getQuestion())
+ ->setHref('/V'.$poll->getID())
+ ->setDisabled($poll->getIsClosed())
+ ->addIcon('none', $date_created);
+
+ $description = $poll->getDescription();
+ if (strlen($description)) {
+ $item->addAttribute(phutil_utf8_shorten($poll->getDescription(), 120));
+ }
+
+ if ($author) {
+ $item->addByline(pht('Author: %s', $author));
+ }
+
+ $list->addItem($item);
+ }
+
+ return $list;
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 12, 10:20 PM (6 d, 5 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6735235
Default Alt Text
D9010.diff (6 KB)

Event Timeline