@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.

Make Project slug/hashtag transactions render a little more nicely

Summary: Ref T12732. Use `renderValue()` to build `renderValueList()` so we get nice fancy text for these.

Test Plan: {F4967410}

Reviewers: chad, amckinley

Reviewed By: amckinley

Maniphest Tasks: T12732

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

+33 -10
+20 -10
src/applications/project/xaction/PhabricatorProjectSlugsTransaction.php
··· 40 40 $add = array_diff($new, $old); 41 41 $rem = array_diff($old, $new); 42 42 43 + $add = $this->renderHashtags($add); 44 + $rem = $this->renderHashtags($rem); 45 + 43 46 if ($add && $rem) { 44 47 return pht( 45 48 '%s changed project hashtag(s), added %d: %s; removed %d: %s.', 46 49 $this->renderAuthor(), 47 50 count($add), 48 - $this->renderSlugList($add), 51 + $this->renderValueList($add), 49 52 count($rem), 50 - $this->renderSlugList($rem)); 53 + $this->renderValueList($rem)); 51 54 } else if ($add) { 52 55 return pht( 53 56 '%s added %d project hashtag(s): %s.', 54 57 $this->renderAuthor(), 55 58 count($add), 56 - $this->renderSlugList($add)); 59 + $this->renderValueList($add)); 57 60 } else if ($rem) { 58 61 return pht( 59 62 '%s removed %d project hashtag(s): %s.', 60 63 $this->renderAuthor(), 61 64 count($rem), 62 - $this->renderSlugList($rem)); 65 + $this->renderValueList($rem)); 63 66 } 64 67 } 65 68 ··· 70 73 $add = array_diff($new, $old); 71 74 $rem = array_diff($old, $new); 72 75 76 + $add = $this->renderHashtags($add); 77 + $rem = $this->renderHashtags($rem); 78 + 73 79 if ($add && $rem) { 74 80 return pht( 75 81 '%s changed %s hashtag(s), added %d: %s; removed %d: %s.', 76 82 $this->renderAuthor(), 77 83 $this->renderObject(), 78 84 count($add), 79 - $this->renderSlugList($add), 85 + $this->renderValueList($add), 80 86 count($rem), 81 - $this->renderSlugList($rem)); 87 + $this->renderValueList($rem)); 82 88 } else if ($add) { 83 89 return pht( 84 90 '%s added %d %s hashtag(s): %s.', 85 91 $this->renderAuthor(), 86 92 count($add), 87 93 $this->renderObject(), 88 - $this->renderSlugList($add)); 94 + $this->renderValueList($add)); 89 95 } else if ($rem) { 90 96 return pht( 91 97 '%s removed %d %s hashtag(s): %s.', 92 98 $this->renderAuthor(), 93 99 count($rem), 94 100 $this->renderObject(), 95 - $this->renderSlugList($rem)); 101 + $this->renderValueList($rem)); 96 102 } 97 103 } 98 104 ··· 157 163 return $errors; 158 164 } 159 165 160 - private function renderSlugList($slugs) { 161 - return implode(', ', $slugs); 166 + private function renderHashtags(array $tags) { 167 + $result = array(); 168 + foreach ($tags as $tag) { 169 + $result[] = '#'.$tag; 170 + } 171 + return $result; 162 172 } 163 173 164 174 }
+13
src/applications/transactions/storage/PhabricatorModularTransactionType.php
··· 208 208 $value); 209 209 } 210 210 211 + final protected function renderValueList(array $values) { 212 + $result = array(); 213 + foreach ($values as $value) { 214 + $result[] = $this->renderValue($value); 215 + } 216 + 217 + if ($this->isTextMode()) { 218 + return implode(', ', $result); 219 + } 220 + 221 + return phutil_implode_html(', ', $result); 222 + } 223 + 211 224 final protected function renderOldValue() { 212 225 return $this->renderValue($this->getOldValue()); 213 226 }