@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 Owners Package hovercard

Summary: Ref T12600. Basically all the property (not path) information on a hovercard for owner packages.

Test Plan:
Create a package with LOTS OF RULES. Test it as open and archived states.

{F4923441}

{F4923444}

Reviewers: epriestley, jmeador

Reviewed By: jmeador

Subscribers: jmeador, Korvin

Maniphest Tasks: T12600

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

+96 -2
+2
src/__phutil_library_map__.php
··· 3204 3204 'PhabricatorOwnersDefaultViewCapability' => 'applications/owners/capability/PhabricatorOwnersDefaultViewCapability.php', 3205 3205 'PhabricatorOwnersDetailController' => 'applications/owners/controller/PhabricatorOwnersDetailController.php', 3206 3206 'PhabricatorOwnersEditController' => 'applications/owners/controller/PhabricatorOwnersEditController.php', 3207 + 'PhabricatorOwnersHovercardEngineExtension' => 'applications/owners/engineextension/PhabricatorOwnersHovercardEngineExtension.php', 3207 3208 'PhabricatorOwnersListController' => 'applications/owners/controller/PhabricatorOwnersListController.php', 3208 3209 'PhabricatorOwnersOwner' => 'applications/owners/storage/PhabricatorOwnersOwner.php', 3209 3210 'PhabricatorOwnersPackage' => 'applications/owners/storage/PhabricatorOwnersPackage.php', ··· 8406 8407 'PhabricatorOwnersDefaultViewCapability' => 'PhabricatorPolicyCapability', 8407 8408 'PhabricatorOwnersDetailController' => 'PhabricatorOwnersController', 8408 8409 'PhabricatorOwnersEditController' => 'PhabricatorOwnersController', 8410 + 'PhabricatorOwnersHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension', 8409 8411 'PhabricatorOwnersListController' => 'PhabricatorOwnersController', 8410 8412 'PhabricatorOwnersOwner' => 'PhabricatorOwnersDAO', 8411 8413 'PhabricatorOwnersPackage' => array(
+89
src/applications/owners/engineextension/PhabricatorOwnersHovercardEngineExtension.php
··· 1 + <?php 2 + 3 + final class PhabricatorOwnersHovercardEngineExtension 4 + extends PhabricatorHovercardEngineExtension { 5 + 6 + const EXTENSIONKEY = 'owners'; 7 + 8 + public function isExtensionEnabled() { 9 + return PhabricatorApplication::isClassInstalled( 10 + 'PhabricatorOwnersApplication'); 11 + } 12 + 13 + public function getExtensionName() { 14 + return pht('Owner Packages'); 15 + } 16 + 17 + public function canRenderObjectHovercard($object) { 18 + return ($object instanceof PhabricatorOwnersPackage); 19 + } 20 + 21 + public function willRenderHovercards(array $objects) { 22 + $viewer = $this->getViewer(); 23 + $phids = mpull($objects, 'getPHID'); 24 + 25 + $packages = id(new PhabricatorOwnersPackageQuery()) 26 + ->setViewer($viewer) 27 + ->withPHIDs($phids) 28 + ->execute(); 29 + $packages = mpull($packages, null, 'getPHID'); 30 + 31 + return array( 32 + 'packages' => $packages, 33 + ); 34 + } 35 + 36 + public function renderHovercard( 37 + PHUIHovercardView $hovercard, 38 + PhabricatorObjectHandle $handle, 39 + $object, 40 + $data) { 41 + 42 + $viewer = $this->getViewer(); 43 + 44 + $package = idx($data['packages'], $object->getPHID()); 45 + if (!$package) { 46 + return; 47 + } 48 + 49 + $title = pht('%s: %s', 'O'.$package->getID(), $package->getName()); 50 + $hovercard->setTitle($title); 51 + 52 + $dominion = $package->getDominion(); 53 + $dominion_map = PhabricatorOwnersPackage::getDominionOptionsMap(); 54 + $spec = idx($dominion_map, $dominion, array()); 55 + $name = idx($spec, 'short', $dominion); 56 + $hovercard->addField(pht('Dominion'), $name); 57 + 58 + $auto = $package->getAutoReview(); 59 + $autoreview_map = PhabricatorOwnersPackage::getAutoreviewOptionsMap(); 60 + $spec = idx($autoreview_map, $auto, array()); 61 + $name = idx($spec, 'name', $auto); 62 + $hovercard->addField(pht('Auto Review'), $name); 63 + 64 + if ($package->isArchived()) { 65 + $tag = id(new PHUITagView()) 66 + ->setName(pht('Archived')) 67 + ->setShade(PHUITagView::COLOR_INDIGO) 68 + ->setType(PHUITagView::TYPE_OBJECT); 69 + $hovercard->addTag($tag); 70 + } 71 + 72 + $owner_phids = $package->getOwnerPHIDs(); 73 + 74 + $hovercard->addField( 75 + pht('Owners'), 76 + $viewer->renderHandleList($owner_phids)->setAsInline(true)); 77 + 78 + $description = $package->getDescription(); 79 + if (strlen($description)) { 80 + $description = id(new PhutilUTF8StringTruncator()) 81 + ->setMaximumGlyphs(120) 82 + ->truncateString($description); 83 + 84 + $hovercard->addField(pht('Description'), $description); 85 + } 86 + 87 + } 88 + 89 + }
+5 -2
src/view/phui/PHUIHovercardView.php
··· 112 112 113 113 $body = array(); 114 114 115 + $body_title = null; 115 116 if ($this->detail) { 116 117 $body_title = $this->detail; 117 - } else { 118 + } else if (!$this->fields) { 118 119 // Fallback for object handles 119 120 $body_title = $handle->getFullName(); 120 121 } 121 122 122 - $body[] = phutil_tag_div('phui-hovercard-body-header', $body_title); 123 + if ($body_title) { 124 + $body[] = phutil_tag_div('phui-hovercard-body-header', $body_title); 125 + } 123 126 124 127 foreach ($this->fields as $field) { 125 128 $item = array(