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

Select all available bodies when rendering a feed story

Summary:
Fixes T4060. The logic here is:

- When you take several actions at once, we show a single feed story for all of them.
- We choose the "most interesting" title for the feed story. For example, "close task" is more interesting than "add CC".

Currently, the issue with this is:

- "Add comment" is the //least interesting// title. I think this is correct: all other actions are more interesting than the fact that you added a comment.
- We try to conserve the number of objects we need to load by rendering only the most interesting transaction.

To fix this:

- Stop being so conservative; load all of the transactions and all of their PHIDs.
- Add bodies from any transactions which render bodies. In all cases (I think?) this is a maximum of one comment adding a body.

The end result is a story like this:

epriestley closed T123: the building is on fire.

"Okay guys I put the fire out"

Test Plan: See screenshot.

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran, asherkin

Maniphest Tasks: T4060

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

+20 -12
+20 -12
src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php
··· 11 11 } 12 12 13 13 public function getRequiredObjectPHIDs() { 14 - return array( 15 - $this->getPrimaryTransactionPHID(), 16 - ); 14 + return $this->getValue('transactionPHIDs'); 17 15 } 18 16 19 17 public function getRequiredHandlePHIDs() { 20 18 $phids = array(); 21 - $phids[] = array($this->getValue('objectPHID')); 22 - $phids[] = $this->getPrimaryTransaction()->getRequiredHandlePHIDs(); 23 - return array_mergev($phids); 19 + $phids[] = $this->getValue('objectPHID'); 20 + foreach ($this->getValue('transactionPHIDs') as $xaction_phid) { 21 + $xaction = $this->getObject($xaction_phid); 22 + foreach ($xaction->getRequiredHandlePHIDs() as $handle_phid) { 23 + $phids[] = $handle_phid; 24 + } 25 + } 26 + return $phids; 24 27 } 25 28 26 29 protected function getPrimaryTransactionPHID() { ··· 40 43 $view->setAppIconFromPHID($handle->getPHID()); 41 44 42 45 $xaction_phids = $this->getValue('transactionPHIDs'); 43 - $xaction = $this->getObject(head($xaction_phids)); 46 + $xaction = $this->getPrimaryTransaction(); 44 47 45 48 $xaction->setHandles($this->getHandles()); 46 49 $view->setTitle($xaction->getTitleForFeed($this)); 47 - $body = $xaction->getBodyForFeed($this); 48 - if (nonempty($body)) { 49 - $view->appendChild($body); 50 + 51 + foreach ($xaction_phids as $xaction_phid) { 52 + $secondary_xaction = $this->getObject($xaction_phid); 53 + $secondary_xaction->setHandles($this->getHandles()); 54 + 55 + $body = $secondary_xaction->getBodyForFeed($this); 56 + if (nonempty($body)) { 57 + $view->appendChild($body); 58 + } 50 59 } 51 60 52 61 $view->setImage( 53 - $this->getHandle( 54 - $this->getPrimaryTransaction()->getAuthorPHID())->getImageURI()); 62 + $this->getHandle($xaction->getAuthorPHID())->getImageURI()); 55 63 56 64 return $view; 57 65 }