@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.

Add an "Advanced/Developer..." action item for viewing object handle details and hovercards

Summary:
Ref T13442. Ref T13157. There's a secret URI to look at an object's hovercard in a standalone view, but it's hard to remember and impossible to discover.

In developer mode, add an action to "View Hovercard". Also add "View Handle", which primarily shows the object PHID.

Test Plan: Viewed some objects, saw "Advanced/Developer...". Used "View Hovercard" to view hovercards and "View Handle" to view handles.

Maniphest Tasks: T13442, T13157

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

+167
+4
src/__phutil_library_map__.php
··· 4648 4648 'PhabricatorSearchEngineExtensionModule' => 'applications/search/engineextension/PhabricatorSearchEngineExtensionModule.php', 4649 4649 'PhabricatorSearchFerretNgramGarbageCollector' => 'applications/search/garbagecollector/PhabricatorSearchFerretNgramGarbageCollector.php', 4650 4650 'PhabricatorSearchField' => 'applications/search/field/PhabricatorSearchField.php', 4651 + 'PhabricatorSearchHandleController' => 'applications/search/controller/PhabricatorSearchHandleController.php', 4651 4652 'PhabricatorSearchHost' => 'infrastructure/cluster/search/PhabricatorSearchHost.php', 4652 4653 'PhabricatorSearchHovercardController' => 'applications/search/controller/PhabricatorSearchHovercardController.php', 4653 4654 'PhabricatorSearchIndexVersion' => 'applications/search/storage/PhabricatorSearchIndexVersion.php', ··· 4872 4873 'PhabricatorSystemActionRateLimitException' => 'applications/system/exception/PhabricatorSystemActionRateLimitException.php', 4873 4874 'PhabricatorSystemApplication' => 'applications/system/application/PhabricatorSystemApplication.php', 4874 4875 'PhabricatorSystemDAO' => 'applications/system/storage/PhabricatorSystemDAO.php', 4876 + 'PhabricatorSystemDebugUIEventListener' => 'applications/system/events/PhabricatorSystemDebugUIEventListener.php', 4875 4877 'PhabricatorSystemDestructionGarbageCollector' => 'applications/system/garbagecollector/PhabricatorSystemDestructionGarbageCollector.php', 4876 4878 'PhabricatorSystemDestructionLog' => 'applications/system/storage/PhabricatorSystemDestructionLog.php', 4877 4879 'PhabricatorSystemObjectController' => 'applications/system/controller/PhabricatorSystemObjectController.php', ··· 11270 11272 'PhabricatorSearchEngineExtensionModule' => 'PhabricatorConfigModule', 11271 11273 'PhabricatorSearchFerretNgramGarbageCollector' => 'PhabricatorGarbageCollector', 11272 11274 'PhabricatorSearchField' => 'Phobject', 11275 + 'PhabricatorSearchHandleController' => 'PhabricatorSearchBaseController', 11273 11276 'PhabricatorSearchHost' => 'Phobject', 11274 11277 'PhabricatorSearchHovercardController' => 'PhabricatorSearchBaseController', 11275 11278 'PhabricatorSearchIndexVersion' => 'PhabricatorSearchDAO', ··· 11511 11514 'PhabricatorSystemActionRateLimitException' => 'Exception', 11512 11515 'PhabricatorSystemApplication' => 'PhabricatorApplication', 11513 11516 'PhabricatorSystemDAO' => 'PhabricatorLiskDAO', 11517 + 'PhabricatorSystemDebugUIEventListener' => 'PhabricatorEventListener', 11514 11518 'PhabricatorSystemDestructionGarbageCollector' => 'PhabricatorGarbageCollector', 11515 11519 'PhabricatorSystemDestructionLog' => 'PhabricatorSystemDAO', 11516 11520 'PhabricatorSystemObjectController' => 'PhabricatorController',
+2
src/applications/search/application/PhabricatorSearchApplication.php
··· 33 33 'index/(?P<phid>[^/]+)/' => 'PhabricatorSearchIndexController', 34 34 'hovercard/' 35 35 => 'PhabricatorSearchHovercardController', 36 + 'handle/(?P<phid>[^/]+)/' 37 + => 'PhabricatorSearchHandleController', 36 38 'edit/' => array( 37 39 'key/(?P<queryKey>[^/]+)/' => 'PhabricatorSearchEditController', 38 40 'id/(?P<id>[^/]+)/' => 'PhabricatorSearchEditController',
+89
src/applications/search/controller/PhabricatorSearchHandleController.php
··· 1 + <?php 2 + 3 + final class PhabricatorSearchHandleController 4 + extends PhabricatorSearchBaseController { 5 + 6 + public function shouldAllowPublic() { 7 + return true; 8 + } 9 + 10 + public function handleRequest(AphrontRequest $request) { 11 + $viewer = $this->getViewer(); 12 + $phid = $request->getURIData('phid'); 13 + 14 + $handles = $viewer->loadHandles(array($phid)); 15 + $handle = $handles[$phid]; 16 + 17 + $cancel_uri = $handle->getURI(); 18 + if (!$cancel_uri) { 19 + $cancel_uri = '/'; 20 + } 21 + 22 + $rows = array(); 23 + 24 + $rows[] = array( 25 + pht('PHID'), 26 + $phid, 27 + ); 28 + 29 + $rows[] = array( 30 + pht('PHID Type'), 31 + phid_get_type($phid), 32 + ); 33 + 34 + $rows[] = array( 35 + pht('URI'), 36 + $handle->getURI(), 37 + ); 38 + 39 + $icon = $handle->getIcon(); 40 + if ($icon !== null) { 41 + $icon = id(new PHUIIconView()) 42 + ->setIcon($handle->getIcon()); 43 + } 44 + 45 + $rows[] = array( 46 + pht('Icon'), 47 + $icon, 48 + ); 49 + 50 + $rows[] = array( 51 + pht('Object Name'), 52 + $handle->getObjectName(), 53 + ); 54 + 55 + $rows[] = array( 56 + pht('Name'), 57 + $handle->getName(), 58 + ); 59 + 60 + $rows[] = array( 61 + pht('Full Name'), 62 + $handle->getFullName(), 63 + ); 64 + 65 + $rows[] = array( 66 + pht('Tag'), 67 + $handle->renderTag(), 68 + ); 69 + 70 + $rows[] = array( 71 + pht('Link'), 72 + $handle->renderLink(), 73 + ); 74 + 75 + $table = id(new AphrontTableView($rows)) 76 + ->setColumnClasses( 77 + array( 78 + 'header', 79 + 'wide', 80 + )); 81 + 82 + return $this->newDialog() 83 + ->setTitle(pht('Handle: %s', $phid)) 84 + ->setWidth(AphrontDialogView::WIDTH_FORM) 85 + ->appendChild($table) 86 + ->addCancelButton($cancel_uri, pht('Done')); 87 + } 88 + 89 + }
+6
src/applications/system/application/PhabricatorSystemApplication.php
··· 14 14 return true; 15 15 } 16 16 17 + public function getEventListeners() { 18 + return array( 19 + new PhabricatorSystemDebugUIEventListener(), 20 + ); 21 + } 22 + 17 23 public function getRoutes() { 18 24 return array( 19 25 '/status/' => 'PhabricatorStatusController',
+58
src/applications/system/events/PhabricatorSystemDebugUIEventListener.php
··· 1 + <?php 2 + 3 + final class PhabricatorSystemDebugUIEventListener 4 + extends PhabricatorEventListener { 5 + 6 + public function register() { 7 + $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); 8 + } 9 + 10 + public function handleEvent(PhutilEvent $event) { 11 + switch ($event->getType()) { 12 + case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS: 13 + $this->handleActionEvent($event); 14 + break; 15 + } 16 + } 17 + 18 + private function handleActionEvent($event) { 19 + $viewer = $event->getUser(); 20 + $object = $event->getValue('object'); 21 + 22 + if (!PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) { 23 + return; 24 + } 25 + 26 + if (!$object || !$object->getPHID()) { 27 + // If we have no object, or the object doesn't have a PHID, we can't 28 + // do anything useful. 29 + return; 30 + } 31 + 32 + $phid = $object->getPHID(); 33 + 34 + $submenu = array(); 35 + 36 + $submenu[] = id(new PhabricatorActionView()) 37 + ->setIcon('fa-asterisk') 38 + ->setName(pht('View Handle')) 39 + ->setHref(urisprintf('/search/handle/%s/', $phid)) 40 + ->setWorkflow(true); 41 + 42 + $submenu[] = id(new PhabricatorActionView()) 43 + ->setIcon('fa-address-card-o') 44 + ->setName(pht('View Hovercard')) 45 + ->setHref(urisprintf('/search/hovercard/?phids[]=%s', $phid)); 46 + 47 + $developer_action = id(new PhabricatorActionView()) 48 + ->setName(pht('Advanced/Developer...')) 49 + ->setIcon('fa-magic') 50 + ->setOrder(9001) 51 + ->setSubmenu($submenu); 52 + 53 + $actions = $event->getValue('actions'); 54 + $actions[] = $developer_action; 55 + $event->setValue('actions', $actions); 56 + } 57 + 58 + }
+8
src/view/layout/PhabricatorActionListView.php
··· 52 52 $action->setViewer($viewer); 53 53 } 54 54 55 + $sort = array(); 56 + foreach ($actions as $key => $action) { 57 + $sort[$key] = id(new PhutilSortVector()) 58 + ->addInt($action->getOrder()); 59 + } 60 + $sort = msortv($sort, 'getSelf'); 61 + $actions = array_select_keys($actions, array_keys($sort)); 62 + 55 63 require_celerity_resource('phabricator-action-list-view-css'); 56 64 57 65 $items = array();