diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -447,30 +447,6 @@ ->execute(); } - /** - * Render a list of links to handles, identified by PHIDs. The handles must - * already be loaded. - * - * @param list List of PHIDs to render links to. - * @param string Style, one of "\n" (to put each item on its own line) - * or "," (to list items inline, separated by commas). - * @return string Rendered list of handle links. - */ - protected function renderHandlesForPHIDs(array $phids, $style = "\n") { - $style_map = array( - "\n" => phutil_tag('br'), - ',' => ', ', - ); - - if (empty($style_map[$style])) { - throw new Exception("Unknown handle list style '{$style}'!"); - } - - return implode_selected_handle_links($style_map[$style], - $this->handles, - array_filter($phids)); - } - public function buildApplicationMenu() { return null; } diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -614,13 +614,11 @@ } if ($reverts_phids) { - $this->loadHandles($reverts_phids); - $props[pht('Reverts')] = $this->renderHandlesForPHIDs($reverts_phids); + $props[pht('Reverts')] = $viewer->renderHandleList($reverts_phids); } if ($reverted_by_phids) { - $this->loadHandles($reverted_by_phids); - $props[pht('Reverted By')] = $this->renderHandlesForPHIDs( + $props[pht('Reverted By')] = $viewer->renderHandleList( $reverted_by_phids); } diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php @@ -234,10 +234,9 @@ $repository->getPHID(), PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); if ($project_phids) { - $this->loadHandles($project_phids); $view->addProperty( pht('Projects'), - $this->renderHandlesForPHIDs($project_phids)); + $user->renderHandleList($project_phids)); } if ($repository->isHosted()) { diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php @@ -265,8 +265,7 @@ $repository->getPHID(), PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); if ($project_phids) { - $this->loadHandles($project_phids); - $project_text = $this->renderHandlesForPHIDs($project_phids); + $project_text = $viewer->renderHandleList($project_phids); } else { $project_text = phutil_tag('em', array(), pht('None')); } @@ -546,10 +545,9 @@ $credential_phid = $repository->getCredentialPHID(); if ($credential_phid) { - $this->loadHandles(array($credential_phid)); $view->addProperty( pht('Credential'), - $this->getHandle($credential_phid)->renderLink()); + $viewer->renderHandle($credential_phid)); } return $view; @@ -584,8 +582,7 @@ $service_phid = $repository->getAlmanacServicePHID(); if ($service_phid) { - $handles = $this->loadViewerHandles(array($service_phid)); - $v_service = $handles[$service_phid]->renderLink(); + $v_service = $viewer->renderHandle($service_phid); } else { $v_service = phutil_tag( 'em', diff --git a/src/applications/phid/view/PHUIHandleListView.php b/src/applications/phid/view/PHUIHandleListView.php --- a/src/applications/phid/view/PHUIHandleListView.php +++ b/src/applications/phid/view/PHUIHandleListView.php @@ -11,20 +11,20 @@ extends AphrontTagView { private $handleList; - private $inline; + private $asInline; public function setHandleList(PhabricatorHandleList $list) { $this->handleList = $list; return $this; } - public function setInline($inline) { - $this->inline = $inline; + public function setAsInline($inline) { + $this->asInline = $inline; return $this; } - public function getInline() { - return $this->inline; + public function getAsInline() { + return $this->asInline; } protected function getTagName() { @@ -39,7 +39,7 @@ $items[] = $handle->renderLink(); } - if ($this->getInline()) { + if ($this->getAsInline()) { $items = phutil_implode_html(', ', $items); } else { $items = phutil_implode_html(phutil_tag('br'), $items); diff --git a/src/applications/phid/view/PHUIHandleView.php b/src/applications/phid/view/PHUIHandleView.php --- a/src/applications/phid/view/PHUIHandleView.php +++ b/src/applications/phid/view/PHUIHandleView.php @@ -13,6 +13,7 @@ private $handleList; private $handlePHID; + private $asTag; public function setHandleList(PhabricatorHandleList $list) { $this->handleList = $list; @@ -24,8 +25,18 @@ return $this; } + public function setAsTag($tag) { + $this->asTag = $tag; + return $this; + } + public function render() { - return $this->handleList[$this->handlePHID]->renderLink(); + $handle = $this->handleList[$this->handlePHID]; + if ($this->asTag) { + return $handle->renderTag(); + } else { + return $handle->renderLink(); + } } } diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php --- a/src/applications/project/controller/PhabricatorProjectProfileController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileController.php @@ -167,11 +167,6 @@ $request = $this->getRequest(); $viewer = $request->getUser(); - $this->loadHandles( - array_merge( - $project->getMemberPHIDs(), - $project->getWatcherPHIDs())); - $view = id(new PHUIPropertyListView()) ->setUser($viewer) ->setObject($project) @@ -189,24 +184,26 @@ $view->addProperty( pht('Members'), $project->getMemberPHIDs() - ? $this->renderHandlesForPHIDs($project->getMemberPHIDs(), ',') + ? $viewer + ->renderHandleList($project->getMemberPHIDs()) + ->setAsInline(true) : phutil_tag('em', array(), pht('None'))); $view->addProperty( pht('Watchers'), $project->getWatcherPHIDs() - ? $this->renderHandlesForPHIDs($project->getWatcherPHIDs(), ',') + ? $viewer + ->renderHandleList($project->getWatcherPHIDs()) + ->setAsInline(true) : phutil_tag('em', array(), pht('None'))); $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( $viewer, $project); - $this->loadHandles(array($project->getPHID())); - $view->addProperty( pht('Looks Like'), - $this->getHandle($project->getPHID())->renderTag()); + $viewer->renderHandle($project->getPHID())->setAsTag(true)); $view->addProperty( pht('Joinable By'), diff --git a/src/applications/releeph/controller/product/ReleephProductViewController.php b/src/applications/releeph/controller/product/ReleephProductViewController.php --- a/src/applications/releeph/controller/product/ReleephProductViewController.php +++ b/src/applications/releeph/controller/product/ReleephProductViewController.php @@ -55,9 +55,6 @@ ->execute(); $repos = mpull($repos, null, 'getPHID'); - $phids = mpull($branches, 'getCreatedByUserPHID'); - $this->loadHandles($phids); - $requests = array(); if ($branches) { $requests = id(new ReleephRequestQuery()) @@ -237,10 +234,9 @@ $pushers = $product->getPushers(); if ($pushers) { - $this->loadHandles($pushers); $properties->addProperty( pht('Pushers'), - $this->renderHandlesForPHIDs($pushers)); + $viewer->renderHandleList($pushers)); } return id(new PHUIObjectBoxView()) diff --git a/src/applications/transactions/controller/PhabricatorApplicationTransactionValueController.php b/src/applications/transactions/controller/PhabricatorApplicationTransactionValueController.php --- a/src/applications/transactions/controller/PhabricatorApplicationTransactionValueController.php +++ b/src/applications/transactions/controller/PhabricatorApplicationTransactionValueController.php @@ -63,8 +63,6 @@ $rule_objects[$class] = newv($class, array()); } $policy->attachRuleObjects($rule_objects); - $handle_phids = $this->extractPHIDs($policy, $rule_objects); - $handles = $this->loadHandles($handle_phids); $this->requireResource('policy-transaction-detail-css'); $cancel_uri = $this->guessCancelURI($viewer, $xaction); @@ -114,13 +112,17 @@ ->setIconFont($icon) ->setText( ucfirst($rule['action']).' '.$rule_object->getRuleDescription()); - $handle_phids = - $rule_object->getRequiredHandlePHIDsForSummary($rule['value']); + + $handle_phids = $rule_object->getRequiredHandlePHIDsForSummary( + $rule['value']); if ($handle_phids) { - $value = $this->renderHandlesForPHIDs($handle_phids, ','); + $value = $this->getViewer() + ->renderHandleList($handle_phids) + ->setInline(true); } else { $value = $rule['value']; } + $details[] = phutil_tag('div', array( 'class' => 'policy-transaction-detail-row',