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

Allow Harbormaster build plans to be tagged with projects and searched by tag

Summary: Ref T10457. This is mostly just for consitency, but I imagine it will make managing large/complex build processes easier, and if we support Herald rules it would eventually let you write "Build plan's tags include [whatever]" to apply behavior to a group of plans.

Test Plan: {F1133107}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10457

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

+32 -4
+1
src/__phutil_library_map__.php
··· 5201 5201 'PhabricatorPolicyInterface', 5202 5202 'PhabricatorSubscribableInterface', 5203 5203 'PhabricatorNgramsInterface', 5204 + 'PhabricatorProjectInterface', 5204 5205 ), 5205 5206 'HarbormasterBuildPlanDatasource' => 'PhabricatorTypeaheadDatasource', 5206 5207 'HarbormasterBuildPlanDefaultEditCapability' => 'PhabricatorPolicyCapability',
+24 -1
src/applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php
··· 84 84 85 85 $viewer = $this->requireViewer(); 86 86 87 + 88 + if ($plans) { 89 + $edge_query = id(new PhabricatorEdgeQuery()) 90 + ->withSourcePHIDs(mpull($plans, 'getPHID')) 91 + ->withEdgeTypes( 92 + array( 93 + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, 94 + )); 95 + 96 + $edge_query->execute(); 97 + } 98 + 87 99 $list = new PHUIObjectItemListView(); 88 100 foreach ($plans as $plan) { 89 101 $id = $plan->getID(); 90 102 91 103 $item = id(new PHUIObjectItemView()) 92 - ->setObjectName(pht('Plan %d', $plan->getID())) 104 + ->setObjectName(pht('Plan %d', $id)) 93 105 ->setHeader($plan->getName()); 94 106 95 107 if ($plan->isDisabled()) { ··· 101 113 } 102 114 103 115 $item->setHref($this->getApplicationURI("plan/{$id}/")); 116 + 117 + $phid = $plan->getPHID(); 118 + $project_phids = $edge_query->getDestinationPHIDs(array($phid)); 119 + $project_handles = $viewer->loadHandles($project_phids); 120 + 121 + $item->addAttribute( 122 + id(new PHUIHandleTagListView()) 123 + ->setLimit(4) 124 + ->setNoDataString(pht('No Projects')) 125 + ->setSlim(true) 126 + ->setHandles($project_handles)); 104 127 105 128 $list->addItem($item); 106 129 }
+2 -1
src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php
··· 8 8 PhabricatorApplicationTransactionInterface, 9 9 PhabricatorPolicyInterface, 10 10 PhabricatorSubscribableInterface, 11 - PhabricatorNgramsInterface { 11 + PhabricatorNgramsInterface, 12 + PhabricatorProjectInterface { 12 13 13 14 protected $name; 14 15 protected $planStatus;
+5 -2
src/applications/phid/view/PHUIHandleTagListView.php
··· 53 53 $handles = $this->handles; 54 54 55 55 // If the list is empty, we may render a "No Projects" tag. 56 - if (!$handles) { 56 + if (!count($handles)) { 57 57 if (strlen($this->noDataString)) { 58 58 $no_data_tag = $this->newPlaceholderTag() 59 59 ->setName($this->noDataString); ··· 61 61 } 62 62 } 63 63 64 - if ($this->limit) { 64 + if ($this->limit && ($this->limit > count($handles))) { 65 + if (!is_array($handles)) { 66 + $handles = iterator_to_array($handles); 67 + } 65 68 $handles = array_slice($handles, 0, $this->limit); 66 69 } 67 70