@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 Conduit rendering to SearchEngine

Summary: Ref T4986. Nothing special.

Test Plan: Looked at Conduit, made a panel.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4986

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

+64 -60
+1 -60
src/applications/conduit/controller/PhabricatorConduitListController.php
··· 1 1 <?php 2 2 3 3 final class PhabricatorConduitListController 4 - extends PhabricatorConduitController 5 - implements PhabricatorApplicationSearchResultsControllerInterface { 4 + extends PhabricatorConduitController { 6 5 7 6 private $queryKey; 8 7 ··· 21 20 ->setSearchEngine(new PhabricatorConduitSearchEngine()) 22 21 ->setNavigation($this->buildSideNavView()); 23 22 return $this->delegateToController($controller); 24 - } 25 - 26 - public function renderResultsList( 27 - array $methods, 28 - PhabricatorSavedQuery $query) { 29 - assert_instances_of($methods, 'ConduitAPIMethod'); 30 - 31 - $viewer = $this->getRequest()->getUser(); 32 - 33 - $out = array(); 34 - 35 - $last = null; 36 - $list = null; 37 - foreach ($methods as $method) { 38 - $app = $method->getApplicationName(); 39 - if ($app !== $last) { 40 - $last = $app; 41 - if ($list) { 42 - $out[] = $list; 43 - } 44 - $list = id(new PHUIObjectItemListView()); 45 - 46 - $app_object = $method->getApplication(); 47 - if ($app_object) { 48 - $app_name = $app_object->getName(); 49 - } else { 50 - $app_name = $app; 51 - } 52 - } 53 - 54 - $method_name = $method->getAPIMethodName(); 55 - 56 - $item = id(new PHUIObjectItemView()) 57 - ->setHeader($method_name) 58 - ->setHref($this->getApplicationURI('method/'.$method_name.'/')) 59 - ->addAttribute($method->getMethodDescription()); 60 - 61 - switch ($method->getMethodStatus()) { 62 - case ConduitAPIMethod::METHOD_STATUS_STABLE: 63 - break; 64 - case ConduitAPIMethod::METHOD_STATUS_UNSTABLE: 65 - $item->addIcon('warning-grey', pht('Unstable')); 66 - $item->setBarColor('yellow'); 67 - break; 68 - case ConduitAPIMethod::METHOD_STATUS_DEPRECATED: 69 - $item->addIcon('warning', pht('Deprecated')); 70 - $item->setBarColor('red'); 71 - break; 72 - } 73 - 74 - $list->addItem($item); 75 - } 76 - 77 - if ($list) { 78 - $out[] = $list; 79 - } 80 - 81 - return $out; 82 23 } 83 24 84 25 }
+63
src/applications/conduit/query/PhabricatorConduitSearchEngine.php
··· 3 3 final class PhabricatorConduitSearchEngine 4 4 extends PhabricatorApplicationSearchEngine { 5 5 6 + public function getApplicationClassName() { 7 + return 'PhabricatorApplicationConduit'; 8 + } 9 + 6 10 public function getPageSize(PhabricatorSavedQuery $saved) { 7 11 return PHP_INT_MAX - 1; 8 12 } ··· 133 137 } 134 138 135 139 return parent::buildSavedQueryFromBuiltin($query_key); 140 + } 141 + 142 + protected function renderResultList( 143 + array $methods, 144 + PhabricatorSavedQuery $query, 145 + array $handles) { 146 + assert_instances_of($methods, 'ConduitAPIMethod'); 147 + 148 + $viewer = $this->requireViewer(); 149 + 150 + $out = array(); 151 + 152 + $last = null; 153 + $list = null; 154 + foreach ($methods as $method) { 155 + $app = $method->getApplicationName(); 156 + if ($app !== $last) { 157 + $last = $app; 158 + if ($list) { 159 + $out[] = $list; 160 + } 161 + $list = id(new PHUIObjectItemListView()); 162 + 163 + $app_object = $method->getApplication(); 164 + if ($app_object) { 165 + $app_name = $app_object->getName(); 166 + } else { 167 + $app_name = $app; 168 + } 169 + } 170 + 171 + $method_name = $method->getAPIMethodName(); 172 + 173 + $item = id(new PHUIObjectItemView()) 174 + ->setHeader($method_name) 175 + ->setHref($this->getApplicationURI('method/'.$method_name.'/')) 176 + ->addAttribute($method->getMethodDescription()); 177 + 178 + switch ($method->getMethodStatus()) { 179 + case ConduitAPIMethod::METHOD_STATUS_STABLE: 180 + break; 181 + case ConduitAPIMethod::METHOD_STATUS_UNSTABLE: 182 + $item->addIcon('warning-grey', pht('Unstable')); 183 + $item->setBarColor('yellow'); 184 + break; 185 + case ConduitAPIMethod::METHOD_STATUS_DEPRECATED: 186 + $item->addIcon('warning', pht('Deprecated')); 187 + $item->setBarColor('red'); 188 + break; 189 + } 190 + 191 + $list->addItem($item); 192 + } 193 + 194 + if ($list) { 195 + $out[] = $list; 196 + } 197 + 198 + return $out; 136 199 } 137 200 138 201 }