@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Simplify how tag lists manage their handles

Summary: Fixes T11493. This code is a little bit weird/clever, simplify it so that we always cast the handles to an array early on.

Test Plan: {F1767668}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11493

Differential Revision: https://secure.phabricator.com/D16422

+25 -19
+25 -19
src/applications/phid/view/PHUIHandleTagListView.php
··· 61 61 } 62 62 } 63 63 64 - if ($this->limit && (count($handles) > $this->limit)) { 65 - if (!is_array($handles)) { 66 - $handles = iterator_to_array($handles); 67 - } 68 - $handles = array_slice($handles, 0, $this->limit); 64 + // We may be passed a PhabricatorHandleList; if we are, convert it into 65 + // a normal array. 66 + if (!is_array($handles)) { 67 + $handles = iterator_to_array($handles); 68 + } 69 + 70 + $over_limit = $this->limit && (count($handles) > $this->limit); 71 + if ($over_limit) { 72 + $visible = array_slice($handles, 0, $this->limit); 73 + } else { 74 + $visible = $handles; 69 75 } 70 76 71 77 $list = array(); 72 - foreach ($handles as $handle) { 78 + foreach ($visible as $handle) { 73 79 $tag = $handle->renderTag(); 74 80 if ($this->showHovercards) { 75 81 $tag->setPHID($handle->getPHID()); ··· 84 90 )); 85 91 } 86 92 87 - if ($this->limit) { 88 - if (count($this->handles) > $this->limit) { 89 - $tip_text = implode(', ', mpull($this->handles, 'getName')); 93 + if ($over_limit) { 94 + $tip_text = implode(', ', mpull($handles, 'getName')); 90 95 91 - $more = $this->newPlaceholderTag() 92 - ->setName("\xE2\x80\xA6") 93 - ->addSigil('has-tooltip') 94 - ->setMetadata( 95 - array( 96 - 'tip' => $tip_text, 97 - 'size' => 200, 98 - )); 96 + Javelin::initBehavior('phabricator-tooltips'); 99 97 100 - $list[] = $this->newItem($more); 101 - } 98 + $more = $this->newPlaceholderTag() 99 + ->setName("\xE2\x80\xA6") 100 + ->addSigil('has-tooltip') 101 + ->setMetadata( 102 + array( 103 + 'tip' => $tip_text, 104 + 'size' => 200, 105 + )); 106 + 107 + $list[] = $this->newItem($more); 102 108 } 103 109 104 110 return $list;