Differential D16900 Diff 40685 src/applications/maniphest/controller/ManiphestTaskDetailController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/controller/ManiphestTaskDetailController.php
Show First 20 Lines • Show All 504 Lines • ▼ Show 20 Lines | foreach ($out_phids as $key => $out_phid) { | ||||
} | } | ||||
} | } | ||||
if (!$in_phids && !$out_phids) { | if (!$in_phids && !$out_phids) { | ||||
return null; | return null; | ||||
} | } | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$in_handles = $viewer->loadHandles($in_phids); | |||||
$out_handles = $viewer->loadHandles($out_phids); | |||||
$in_handles = $this->getCompleteHandles($in_handles); | |||||
$out_handles = $this->getCompleteHandles($out_handles); | |||||
if (!count($in_handles) && !count($out_handles)) { | |||||
return null; | |||||
} | |||||
$view = new PHUIPropertyListView(); | $view = new PHUIPropertyListView(); | ||||
if ($in_phids) { | if (count($in_handles)) { | ||||
$in_handles = $viewer->loadHandles($in_phids); | |||||
$view->addProperty(pht('Mentioned In'), $in_handles->renderList()); | $view->addProperty(pht('Mentioned In'), $in_handles->renderList()); | ||||
} | } | ||||
if ($out_phids) { | if (count($out_handles)) { | ||||
$out_handles = $viewer->loadHandles($out_phids); | |||||
$view->addProperty(pht('Mentioned Here'), $out_handles->renderList()); | $view->addProperty(pht('Mentioned Here'), $out_handles->renderList()); | ||||
} | } | ||||
return id(new PHUITabView()) | return id(new PHUITabView()) | ||||
->setName(pht('Mentions')) | ->setName(pht('Mentions')) | ||||
->setKey('mentions') | ->setKey('mentions') | ||||
->appendChild($view); | ->appendChild($view); | ||||
} | } | ||||
private function getCompleteHandles(PhabricatorHandleList $handles) { | |||||
$phids = array(); | |||||
foreach ($handles as $phid => $handle) { | |||||
if (!$handle->isComplete()) { | |||||
continue; | |||||
} | |||||
$phids[] = $phid; | |||||
} | |||||
return $handles->newSublist($phids); | |||||
} | |||||
} | } |