diff --git a/src/applications/phid/view/PHUIHandleListView.php b/src/applications/phid/view/PHUIHandleListView.php index d15b3d15c6..24104fe76d 100644 --- a/src/applications/phid/view/PHUIHandleListView.php +++ b/src/applications/phid/view/PHUIHandleListView.php @@ -14,6 +14,7 @@ final class PHUIHandleListView private $asInline; private $asText; private $showStateIcons; + private $glyphLimit; public function setHandleList(PhabricatorHandleList $list) { $this->handleList = $list; @@ -47,6 +48,15 @@ final class PHUIHandleListView return $this->showStateIcons; } + public function setGlyphLimit($glyph_limit) { + $this->glyphLimit = $glyph_limit; + return $this; + } + + public function getGlyphLimit() { + return $this->glyphLimit; + } + protected function getTagName() { if ($this->getAsText()) { return null; @@ -61,6 +71,7 @@ final class PHUIHandleListView $list = $this->handleList; $show_state_icons = $this->getShowStateIcons(); + $glyph_limit = $this->getGlyphLimit(); $items = array(); foreach ($list as $handle) { @@ -72,6 +83,10 @@ final class PHUIHandleListView $view->setShowStateIcon(true); } + if ($glyph_limit) { + $view->setGlyphLimit($glyph_limit); + } + $items[] = $view; } diff --git a/src/applications/phid/view/PHUIHandleView.php b/src/applications/phid/view/PHUIHandleView.php index 96ae7de025..fe3c62a9ac 100644 --- a/src/applications/phid/view/PHUIHandleView.php +++ b/src/applications/phid/view/PHUIHandleView.php @@ -18,6 +18,7 @@ final class PHUIHandleView private $useShortName; private $showHovercard; private $showStateIcon; + private $glyphLimit; public function setHandleList(PhabricatorHandleList $list) { $this->handleList = $list; @@ -58,6 +59,15 @@ final class PHUIHandleView return $this->showStateIcon; } + public function setGlyphLimit($glyph_limit) { + $this->glyphLimit = $glyph_limit; + return $this; + } + + public function getGlyphLimit() { + return $this->glyphLimit; + } + public function render() { $handle = $this->handleList[$this->handlePHID]; @@ -78,7 +88,14 @@ final class PHUIHandleView if ($this->useShortName) { $name = $handle->getName(); } else { - $name = null; + $name = $handle->getLinkName(); + } + + $glyph_limit = $this->getGlyphLimit(); + if ($glyph_limit) { + $name = id(new PhutilUTF8StringTruncator()) + ->setMaximumGlyphs($glyph_limit) + ->truncateString($name); } if ($this->showHovercard) { diff --git a/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php b/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php index 8f6e4e48d7..6d76319de8 100644 --- a/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php +++ b/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php @@ -294,7 +294,8 @@ final class PHUIDiffTableOfContentsItemView extends AphrontView { $viewer = $this->getUser(); $package_phids = mpull($packages, 'getPHID'); - return $viewer->renderHandleList($package_phids); + return $viewer->renderHandleList($package_phids) + ->setGlyphLimit(48); } private function renderRename($self, $other, $arrow) {