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

Added basic hovercard controller

Summary:
Refs T1048; Depends on D5542, D5543, D5544 - It currently just renders multiple hovercards nicely for test purposes. More is on the way.

Mode `test`: Human test chamber.
Mode `retrieve`: For JS. Added so it would not clash with search key routing.

badassery

Test Plan:
`/search/hovercard/test/?phids[hover-T4]=PHID-TASK-g5pduvwrrwvkq5gkx736&phids[hover-T2]=PHID-TASK-gta6lzaaagziavkktima`

Verified the appearance of two tasks with correct rendering and correct ids

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1048

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

authored by

Anh Nhan Nguyen and committed by
epriestley
d5841fe4 c9cc59a7

+67
+2
src/__phutil_library_map__.php
··· 1300 1300 'PhabricatorSearchEngineMySQL' => 'applications/search/engine/PhabricatorSearchEngineMySQL.php', 1301 1301 'PhabricatorSearchEngineSelector' => 'applications/search/selector/PhabricatorSearchEngineSelector.php', 1302 1302 'PhabricatorSearchField' => 'applications/search/constants/PhabricatorSearchField.php', 1303 + 'PhabricatorSearchHovercardController' => 'applications/search/controller/PhabricatorSearchHovercardController.php', 1303 1304 'PhabricatorSearchIndexer' => 'applications/search/index/PhabricatorSearchIndexer.php', 1304 1305 'PhabricatorSearchManagementIndexWorkflow' => 'applications/search/management/PhabricatorSearchManagementIndexWorkflow.php', 1305 1306 'PhabricatorSearchManagementWorkflow' => 'applications/search/management/PhabricatorSearchManagementWorkflow.php', ··· 2962 2963 'PhabricatorSearchDocumentRelationship' => 'PhabricatorSearchDAO', 2963 2964 'PhabricatorSearchEngineElastic' => 'PhabricatorSearchEngine', 2964 2965 'PhabricatorSearchEngineMySQL' => 'PhabricatorSearchEngine', 2966 + 'PhabricatorSearchHovercardController' => 'PhabricatorSearchBaseController', 2965 2967 'PhabricatorSearchManagementIndexWorkflow' => 'PhabricatorSearchManagementWorkflow', 2966 2968 'PhabricatorSearchManagementWorkflow' => 'PhutilArgumentWorkflow', 2967 2969 'PhabricatorSearchQuery' => 'PhabricatorSearchDAO',
+2
src/aphront/configuration/AphrontDefaultApplicationConfiguration.php
··· 81 81 'select/(?P<type>\w+)/' 82 82 => 'PhabricatorSearchSelectController', 83 83 'index/(?P<phid>[^/]+)/' => 'PhabricatorSearchIndexController', 84 + 'hovercard/(?P<mode>retrieve|test)/' => 85 + 'PhabricatorSearchHovercardController', 84 86 ), 85 87 86 88 '/status/' => 'PhabricatorStatusController',
+63
src/applications/search/controller/PhabricatorSearchHovercardController.php
··· 1 + <?php 2 + 3 + /** 4 + * @group search 5 + */ 6 + final class PhabricatorSearchHovercardController 7 + extends PhabricatorSearchBaseController { 8 + 9 + public function processRequest() { 10 + $request = $this->getRequest(); 11 + $user = $request->getUser(); 12 + 13 + $phids = $request->getArr('phids'); 14 + 15 + $handle_data = new PhabricatorObjectHandleData($phids); 16 + $handle_data->setViewer($user); 17 + $handles = $handle_data->loadHandles(); 18 + $objects = $handle_data->loadObjects(); 19 + 20 + $cards = array(); 21 + 22 + foreach ($phids as $phid) { 23 + $handle = $handles[$phid]; 24 + 25 + $hovercard = new PhabricatorHovercardView(); 26 + $hovercard->setObjectHandle($handle); 27 + 28 + // Send it to the other side of the world, thanks to PhutilEventEngine 29 + $event = new PhabricatorEvent( 30 + PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD, 31 + array( 32 + 'hovercard' => $hovercard, 33 + 'handle' => $handle, 34 + 'object' => idx($objects, $phid), 35 + )); 36 + $event->setUser($user); 37 + PhutilEventEngine::dispatchEvent($event); 38 + 39 + $cards[$phid] = $hovercard; 40 + } 41 + 42 + // Browser-friendly for non-Ajax requests 43 + if (!$request->isAjax()) { 44 + foreach ($cards as $key => $hovercard) { 45 + $cards[$key] = phutil_tag('div', 46 + array( 47 + 'style' => 'margin: 20px;', 48 + ), 49 + $hovercard); 50 + } 51 + 52 + return $this->buildApplicationPage( 53 + $cards, 54 + array( 55 + 'dust' => true, 56 + )); 57 + } 58 + 59 + // TODO: Write a reasonable way to provide client-side-ready hovercard 60 + // put-into-the-browser markup (coming in the next diff) 61 + } 62 + 63 + }