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

Update some PhamePost transactions

Summary: Cleans up some language, colors, etc.

Test Plan: Write lots of new posts, hide them, edit them, check history.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9360

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

+23 -40
+23 -40
src/applications/phame/storage/PhamePostTransaction.php
··· 4 4 extends PhabricatorApplicationTransaction { 5 5 6 6 const TYPE_TITLE = 'phame.post.title'; 7 - const TYPE_PHAME_TITLE = 'phame.post.phame.title'; 8 7 const TYPE_BODY = 'phame.post.body'; 9 8 const TYPE_VISIBILITY = 'phame.post.visibility'; 10 9 const TYPE_BLOG = 'phame.post.blog'; ··· 39 38 } 40 39 41 40 public function shouldHide() { 42 - $old = $this->getOldValue(); 43 - switch ($this->getTransactionType()) { 44 - case self::TYPE_PHAME_TITLE: 45 - case self::TYPE_BODY: 46 - return ($old === null); 47 - } 48 41 return parent::shouldHide(); 49 42 } 50 43 ··· 72 65 73 66 public function getIcon() { 74 67 $old = $this->getOldValue(); 68 + $new = $this->getNewValue(); 75 69 switch ($this->getTransactionType()) { 76 - case self::TYPE_TITLE: 77 - if ($old === null) { 78 - return 'fa-plus'; 70 + case PhabricatorTransactions::TYPE_CREATE: 71 + return 'fa-plus'; 72 + break; 73 + case self::TYPE_VISIBILITY: 74 + if ($new == PhameConstants::VISIBILITY_PUBLISHED) { 75 + return 'fa-globe'; 79 76 } else { 80 - return 'fa-pencil'; 77 + return 'fa-eye-slash'; 81 78 } 82 - break; 83 - case self::TYPE_PHAME_TITLE: 84 - case self::TYPE_BODY: 85 - case self::TYPE_VISIBILITY: 86 - return 'fa-pencil'; 87 - break; 79 + break; 88 80 } 89 81 return parent::getIcon(); 90 82 } ··· 100 92 $tags[] = self::MAILTAG_SUBSCRIBERS; 101 93 break; 102 94 case self::TYPE_TITLE: 103 - case self::TYPE_PHAME_TITLE: 104 95 case self::TYPE_BODY: 105 96 $tags[] = self::MAILTAG_CONTENT; 106 97 break; ··· 123 114 switch ($type) { 124 115 case PhabricatorTransactions::TYPE_CREATE: 125 116 return pht( 126 - '%s created this post.', 117 + '%s authored this post.', 127 118 $this->renderHandleLink($author_phid)); 128 119 case self::TYPE_BLOG: 129 120 return pht( ··· 159 150 $this->renderHandleLink($author_phid)); 160 151 } 161 152 break; 162 - case self::TYPE_PHAME_TITLE: 163 - return pht( 164 - '%s updated the post\'s Phame title to "%s".', 165 - $this->renderHandleLink($author_phid), 166 - rtrim($new, '/')); 167 - break; 168 153 } 169 154 170 155 return parent::getTitle(); ··· 179 164 180 165 $type = $this->getTransactionType(); 181 166 switch ($type) { 167 + case PhabricatorTransactions::TYPE_CREATE: 168 + return pht( 169 + '%s authored %s.', 170 + $this->renderHandleLink($author_phid), 171 + $this->renderHandleLink($object_phid)); 182 172 case self::TYPE_BLOG: 183 173 return pht( 184 174 '%s moved post "%s" from "%s" to "%s".', ··· 218 208 $this->renderHandleLink($object_phid)); 219 209 } 220 210 break; 221 - case self::TYPE_PHAME_TITLE: 222 - return pht( 223 - '%s updated the Phame title for %s.', 224 - $this->renderHandleLink($author_phid), 225 - $this->renderHandleLink($object_phid)); 226 - break; 227 211 } 228 212 229 213 return parent::getTitleForFeed(); 230 214 } 231 215 232 216 public function getRemarkupBodyForFeed(PhabricatorFeedStory $story) { 217 + $old = $this->getOldValue(); 218 + 233 219 switch ($this->getTransactionType()) { 234 220 case self::TYPE_BODY: 235 - return $this->getNewValue(); 221 + if ($old === null) { 222 + return $this->getNewValue(); 223 + } 224 + break; 236 225 } 237 226 238 227 return null; 239 228 } 240 229 241 230 public function getColor() { 242 - $old = $this->getOldValue(); 243 - 244 231 switch ($this->getTransactionType()) { 245 - case self::TYPE_TITLE: 246 - if ($old === null) { 247 - return PhabricatorTransactions::COLOR_GREEN; 248 - } 249 - break; 232 + case PhabricatorTransactions::TYPE_CREATE: 233 + return PhabricatorTransactions::COLOR_GREEN; 250 234 } 251 - 252 235 return parent::getColor(); 253 236 } 254 237