@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Move even more rendering into SearchEngine

Summary: Ref T4986. I think this is the last of the easy ones, there are about 10 not-quite-so-trivial ones left.

Test Plan:
- Viewed app results.
- Created panels.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4986

Differential Revision: https://secure.phabricator.com/D9025

+103 -97
+2 -10
src/__phutil_library_map__.php
··· 4895 4895 'PhabricatorSearchAttachController' => 'PhabricatorSearchBaseController', 4896 4896 'PhabricatorSearchBaseController' => 'PhabricatorController', 4897 4897 'PhabricatorSearchConfigOptions' => 'PhabricatorApplicationConfigOptions', 4898 - 'PhabricatorSearchController' => 4899 - array( 4900 - 0 => 'PhabricatorSearchBaseController', 4901 - 1 => 'PhabricatorApplicationSearchResultsControllerInterface', 4902 - ), 4898 + 'PhabricatorSearchController' => 'PhabricatorSearchBaseController', 4903 4899 'PhabricatorSearchDAO' => 'PhabricatorLiskDAO', 4904 4900 'PhabricatorSearchDeleteController' => 'PhabricatorSearchBaseController', 4905 4901 'PhabricatorSearchDocument' => 'PhabricatorSearchDAO', ··· 5524 5520 'ReleephProductEditController' => 'ReleephProductController', 5525 5521 'ReleephProductEditor' => 'PhabricatorApplicationTransactionEditor', 5526 5522 'ReleephProductHistoryController' => 'ReleephProductController', 5527 - 'ReleephProductListController' => 5528 - array( 5529 - 0 => 'ReleephController', 5530 - 1 => 'PhabricatorApplicationSearchResultsControllerInterface', 5531 - ), 5523 + 'ReleephProductListController' => 'ReleephController', 5532 5524 'ReleephProductQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 5533 5525 'ReleephProductSearchEngine' => 'PhabricatorApplicationSearchEngine', 5534 5526 'ReleephProductTransaction' => 'PhabricatorApplicationTransaction',
+2 -1
src/applications/diffusion/controller/DiffusionPushLogListController.php
··· 1 1 <?php 2 2 3 - final class DiffusionPushLogListController extends DiffusionPushLogController { 3 + final class DiffusionPushLogListController extends DiffusionPushLogController 4 + implements PhabricatorApplicationSearchResultsControllerInterface { 4 5 5 6 private $queryKey; 6 7
+1 -43
src/applications/releeph/controller/product/ReleephProductListController.php
··· 1 1 <?php 2 2 3 - final class ReleephProductListController extends ReleephController 4 - implements PhabricatorApplicationSearchResultsControllerInterface { 3 + final class ReleephProductListController extends ReleephController { 5 4 6 5 private $queryKey; 7 6 ··· 21 20 ->setNavigation($this->buildSideNavView()); 22 21 23 22 return $this->delegateToController($controller); 24 - } 25 - 26 - public function renderResultsList( 27 - array $products, 28 - PhabricatorSavedQuery $query) { 29 - assert_instances_of($products, 'ReleephProject'); 30 - $viewer = $this->getRequest()->getUser(); 31 - 32 - $list = id(new PHUIObjectItemListView()) 33 - ->setUser($viewer); 34 - 35 - foreach ($products as $product) { 36 - $id = $product->getID(); 37 - 38 - $item = id(new PHUIObjectItemView()) 39 - ->setHeader($product->getName()) 40 - ->setHref($this->getApplicationURI("product/{$id}/")); 41 - 42 - if (!$product->getIsActive()) { 43 - $item->setDisabled(true); 44 - $item->addIcon('none', pht('Inactive')); 45 - } 46 - 47 - $repo = $product->getRepository(); 48 - $item->addAttribute( 49 - phutil_tag( 50 - 'a', 51 - array( 52 - 'href' => '/diffusion/'.$repo->getCallsign().'/', 53 - ), 54 - 'r'.$repo->getCallsign())); 55 - 56 - $arc = $product->getArcanistProject(); 57 - if ($arc) { 58 - $item->addAttribute($arc->getName()); 59 - } 60 - 61 - $list->addItem($item); 62 - } 63 - 64 - return $list; 65 23 } 66 24 67 25 public function buildApplicationCrumbs() {
+48
src/applications/releeph/query/ReleephProductSearchEngine.php
··· 3 3 final class ReleephProductSearchEngine 4 4 extends PhabricatorApplicationSearchEngine { 5 5 6 + public function getApplicationClassName() { 7 + return 'PhabricatorApplicationReleeph'; 8 + } 9 + 6 10 public function buildSavedQueryFromRequest(AphrontRequest $request) { 7 11 $saved = new PhabricatorSavedQuery(); 8 12 ··· 82 86 'inactive' => 0, 83 87 ); 84 88 } 89 + 90 + protected function renderResultList( 91 + array $products, 92 + PhabricatorSavedQuery $query, 93 + array $handles) { 94 + 95 + assert_instances_of($products, 'ReleephProject'); 96 + $viewer = $this->requireViewer(); 97 + 98 + $list = id(new PHUIObjectItemListView()) 99 + ->setUser($viewer); 100 + 101 + foreach ($products as $product) { 102 + $id = $product->getID(); 103 + 104 + $item = id(new PHUIObjectItemView()) 105 + ->setHeader($product->getName()) 106 + ->setHref($this->getApplicationURI("product/{$id}/")); 107 + 108 + if (!$product->getIsActive()) { 109 + $item->setDisabled(true); 110 + $item->addIcon('none', pht('Inactive')); 111 + } 112 + 113 + $repo = $product->getRepository(); 114 + $item->addAttribute( 115 + phutil_tag( 116 + 'a', 117 + array( 118 + 'href' => '/diffusion/'.$repo->getCallsign().'/', 119 + ), 120 + 'r'.$repo->getCallsign())); 121 + 122 + $arc = $product->getArcanistProject(); 123 + if ($arc) { 124 + $item->addAttribute($arc->getName()); 125 + } 126 + 127 + $list->addItem($item); 128 + } 129 + 130 + return $list; 131 + } 132 + 85 133 86 134 }
+4
src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php
··· 3 3 final class PhabricatorRepositoryPushLogSearchEngine 4 4 extends PhabricatorApplicationSearchEngine { 5 5 6 + public function getApplicationClassName() { 7 + return 'PhabricatorApplicationDiffusion'; 8 + } 9 + 6 10 public function buildSavedQueryFromRequest(AphrontRequest $request) { 7 11 $saved = new PhabricatorSavedQuery(); 8 12
+1 -43
src/applications/search/controller/PhabricatorSearchController.php
··· 1 1 <?php 2 2 3 3 final class PhabricatorSearchController 4 - extends PhabricatorSearchBaseController 5 - implements PhabricatorApplicationSearchResultsControllerInterface { 4 + extends PhabricatorSearchBaseController { 6 5 7 6 private $queryKey; 8 7 ··· 94 93 $nav->selectFilter(null); 95 94 96 95 return $nav; 97 - } 98 - 99 - public function renderResultsList( 100 - array $results, 101 - PhabricatorSavedQuery $query) { 102 - 103 - $viewer = $this->getRequest()->getUser(); 104 - 105 - if ($results) { 106 - $objects = id(new PhabricatorObjectQuery()) 107 - ->setViewer($viewer) 108 - ->withPHIDs(mpull($results, 'getPHID')) 109 - ->execute(); 110 - 111 - $output = array(); 112 - foreach ($results as $phid => $handle) { 113 - $view = id(new PhabricatorSearchResultView()) 114 - ->setHandle($handle) 115 - ->setQuery($query) 116 - ->setObject(idx($objects, $phid)); 117 - $output[] = $view->render(); 118 - } 119 - 120 - $results = phutil_tag_div( 121 - 'phabricator-search-result-list', 122 - $output); 123 - } else { 124 - $results = phutil_tag_div( 125 - 'phabricator-search-result-list', 126 - phutil_tag( 127 - 'p', 128 - array('class' => 'phabricator-search-no-results'), 129 - pht('No search results.'))); 130 - } 131 - 132 - return id(new PHUIBoxView()) 133 - ->addMargin(PHUI::MARGIN_LARGE) 134 - ->addPadding(PHUI::PADDING_LARGE) 135 - ->setBorder(true) 136 - ->appendChild($results) 137 - ->addClass('phabricator-search-result-box'); 138 96 } 139 97 140 98 }
+45
src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
··· 3 3 final class PhabricatorSearchApplicationSearchEngine 4 4 extends PhabricatorApplicationSearchEngine { 5 5 6 + public function getApplicationClassName() { 7 + return 'PhabricatorApplicationSearch'; 8 + } 9 + 6 10 public function buildSavedQueryFromRequest(AphrontRequest $request) { 7 11 $saved = new PhabricatorSavedQuery(); 8 12 ··· 233 237 return true; 234 238 } 235 239 240 + protected function renderResultList( 241 + array $results, 242 + PhabricatorSavedQuery $query, 243 + array $handles) { 244 + 245 + $viewer = $this->requireViewer(); 246 + 247 + if ($results) { 248 + $objects = id(new PhabricatorObjectQuery()) 249 + ->setViewer($viewer) 250 + ->withPHIDs(mpull($results, 'getPHID')) 251 + ->execute(); 252 + 253 + $output = array(); 254 + foreach ($results as $phid => $handle) { 255 + $view = id(new PhabricatorSearchResultView()) 256 + ->setHandle($handle) 257 + ->setQuery($query) 258 + ->setObject(idx($objects, $phid)); 259 + $output[] = $view->render(); 260 + } 261 + 262 + $results = phutil_tag_div( 263 + 'phabricator-search-result-list', 264 + $output); 265 + } else { 266 + $results = phutil_tag_div( 267 + 'phabricator-search-result-list', 268 + phutil_tag( 269 + 'p', 270 + array('class' => 'phabricator-search-no-results'), 271 + pht('No search results.'))); 272 + } 273 + 274 + return id(new PHUIBoxView()) 275 + ->addMargin(PHUI::MARGIN_LARGE) 276 + ->addPadding(PHUI::PADDING_LARGE) 277 + ->setBorder(true) 278 + ->appendChild($results) 279 + ->addClass('phabricator-search-result-box'); 280 + } 236 281 237 282 }