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

Pholio - make create stories include the mock description, if there is one.

Summary:
This diff accomplishes this task by adding an arbitrary metadata store to PhabricatorObjectHandle. This seemed like it would be "necessary eventually"; for example if / when we decide we want to show images in these stories we'd need to add some more arbitrary data. A point of debate is this technique will yield the _current_ data and not the data at the time the transaction was originally made. I can see this being both desirable and non-desirable.

Otherwise, the best way to do this is to make a new transaction type specifically for create and store exactly what data we think we would need.

(and there's probably many other ways but they require much more work...)

Test Plan: viewed some pholio create stories and yes, they had the description showing.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Maniphest Tasks: T3685

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

+19 -7
+15 -4
src/applications/pholio/storage/PholioTransaction.php
··· 250 250 return parent::getTitleForFeed(); 251 251 } 252 252 253 - public function getBodyForFeed() { 253 + public function getBodyForFeed(PhabricatorFeedStory $story) { 254 + $text = null; 254 255 switch ($this->getTransactionType()) { 256 + case PholioTransactionType::TYPE_NAME: 257 + if ($this->getOldValue() === null) { 258 + $mock = $story->getPrimaryObject(); 259 + $text = $mock->getDescription(); 260 + } 261 + break; 255 262 case PholioTransactionType::TYPE_INLINE: 256 263 $text = $this->getComment()->getContent(); 257 - return phutil_escape_html_newlines( 258 - phutil_utf8_shorten($text, 128)); 259 264 break; 260 265 } 261 - return parent::getBodyForFeed(); 266 + 267 + if ($text) { 268 + return phutil_escape_html_newlines( 269 + phutil_utf8_shorten($text, 128)); 270 + } 271 + 272 + return parent::getBodyForFeed($story); 262 273 } 263 274 264 275 public function hasChangeDetails() {
+3 -2
src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php
··· 44 44 45 45 $xaction->setHandles($this->getHandles()); 46 46 $view->setTitle($xaction->getTitleForFeed()); 47 - if (nonempty($xaction->getBodyForFeed())) { 48 - $view->appendChild($xaction->getBodyForFeed()); 47 + $body = $xaction->getBodyForFeed($this); 48 + if (nonempty($body)) { 49 + $view->appendChild($body); 49 50 } 50 51 51 52 $view->setImage(
+1 -1
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
··· 383 383 return $this->getTitle(); 384 384 } 385 385 386 - public function getBodyForFeed() { 386 + public function getBodyForFeed(PhabricatorFeedStory $story) { 387 387 $old = $this->getOldValue(); 388 388 $new = $this->getNewValue(); 389 389