Page MenuHomePhabricator

D15360.diff
No OneTemporary

D15360.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -5201,6 +5201,7 @@
'PhabricatorPolicyInterface',
'PhabricatorSubscribableInterface',
'PhabricatorNgramsInterface',
+ 'PhabricatorProjectInterface',
),
'HarbormasterBuildPlanDatasource' => 'PhabricatorTypeaheadDatasource',
'HarbormasterBuildPlanDefaultEditCapability' => 'PhabricatorPolicyCapability',
diff --git a/src/applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php b/src/applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php
--- a/src/applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php
@@ -84,12 +84,24 @@
$viewer = $this->requireViewer();
+
+ if ($plans) {
+ $edge_query = id(new PhabricatorEdgeQuery())
+ ->withSourcePHIDs(mpull($plans, 'getPHID'))
+ ->withEdgeTypes(
+ array(
+ PhabricatorProjectObjectHasProjectEdgeType::EDGECONST,
+ ));
+
+ $edge_query->execute();
+ }
+
$list = new PHUIObjectItemListView();
foreach ($plans as $plan) {
$id = $plan->getID();
$item = id(new PHUIObjectItemView())
- ->setObjectName(pht('Plan %d', $plan->getID()))
+ ->setObjectName(pht('Plan %d', $id))
->setHeader($plan->getName());
if ($plan->isDisabled()) {
@@ -102,6 +114,17 @@
$item->setHref($this->getApplicationURI("plan/{$id}/"));
+ $phid = $plan->getPHID();
+ $project_phids = $edge_query->getDestinationPHIDs(array($phid));
+ $project_handles = $viewer->loadHandles($project_phids);
+
+ $item->addAttribute(
+ id(new PHUIHandleTagListView())
+ ->setLimit(4)
+ ->setNoDataString(pht('No Projects'))
+ ->setSlim(true)
+ ->setHandles($project_handles));
+
$list->addItem($item);
}
diff --git a/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php b/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php
--- a/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php
+++ b/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php
@@ -8,7 +8,8 @@
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
PhabricatorSubscribableInterface,
- PhabricatorNgramsInterface {
+ PhabricatorNgramsInterface,
+ PhabricatorProjectInterface {
protected $name;
protected $planStatus;
diff --git a/src/applications/phid/view/PHUIHandleTagListView.php b/src/applications/phid/view/PHUIHandleTagListView.php
--- a/src/applications/phid/view/PHUIHandleTagListView.php
+++ b/src/applications/phid/view/PHUIHandleTagListView.php
@@ -53,7 +53,7 @@
$handles = $this->handles;
// If the list is empty, we may render a "No Projects" tag.
- if (!$handles) {
+ if (!count($handles)) {
if (strlen($this->noDataString)) {
$no_data_tag = $this->newPlaceholderTag()
->setName($this->noDataString);
@@ -61,7 +61,10 @@
}
}
- if ($this->limit) {
+ if ($this->limit && ($this->limit > count($handles))) {
+ if (!is_array($handles)) {
+ $handles = iterator_to_array($handles);
+ }
$handles = array_slice($handles, 0, $this->limit);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 17, 7:59 AM (6 d, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7390593
Default Alt Text
D15360.diff (3 KB)

Event Timeline