Page MenuHomePhabricator

D19478.id46589.diff
No OneTemporary

D19478.id46589.diff

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
@@ -14,6 +14,7 @@
private $asInline;
private $asText;
private $showStateIcons;
+ private $glyphLimit;
public function setHandleList(PhabricatorHandleList $list) {
$this->handleList = $list;
@@ -47,6 +48,15 @@
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 @@
$list = $this->handleList;
$show_state_icons = $this->getShowStateIcons();
+ $glyph_limit = $this->getGlyphLimit();
$items = array();
foreach ($list as $handle) {
@@ -72,6 +83,10 @@
$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
--- a/src/applications/phid/view/PHUIHandleView.php
+++ b/src/applications/phid/view/PHUIHandleView.php
@@ -18,6 +18,7 @@
private $useShortName;
private $showHovercard;
private $showStateIcon;
+ private $glyphLimit;
public function setHandleList(PhabricatorHandleList $list) {
$this->handleList = $list;
@@ -58,6 +59,15 @@
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 @@
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
--- a/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php
+++ b/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php
@@ -294,7 +294,8 @@
$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) {

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 15, 3:03 PM (1 w, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7258001
Default Alt Text
D19478.id46589.diff (2 KB)

Event Timeline