mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
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
This commit is contained in:
parent
b3f36a94a1
commit
7414777856
1 changed files with 20 additions and 12 deletions
|
@ -11,16 +11,19 @@ class PhabricatorApplicationTransactionFeedStory
|
|||
}
|
||||
|
||||
public function getRequiredObjectPHIDs() {
|
||||
return array(
|
||||
$this->getPrimaryTransactionPHID(),
|
||||
);
|
||||
return $this->getValue('transactionPHIDs');
|
||||
}
|
||||
|
||||
public function getRequiredHandlePHIDs() {
|
||||
$phids = array();
|
||||
$phids[] = array($this->getValue('objectPHID'));
|
||||
$phids[] = $this->getPrimaryTransaction()->getRequiredHandlePHIDs();
|
||||
return array_mergev($phids);
|
||||
$phids[] = $this->getValue('objectPHID');
|
||||
foreach ($this->getValue('transactionPHIDs') as $xaction_phid) {
|
||||
$xaction = $this->getObject($xaction_phid);
|
||||
foreach ($xaction->getRequiredHandlePHIDs() as $handle_phid) {
|
||||
$phids[] = $handle_phid;
|
||||
}
|
||||
}
|
||||
return $phids;
|
||||
}
|
||||
|
||||
protected function getPrimaryTransactionPHID() {
|
||||
|
@ -40,18 +43,23 @@ class PhabricatorApplicationTransactionFeedStory
|
|||
$view->setAppIconFromPHID($handle->getPHID());
|
||||
|
||||
$xaction_phids = $this->getValue('transactionPHIDs');
|
||||
$xaction = $this->getObject(head($xaction_phids));
|
||||
$xaction = $this->getPrimaryTransaction();
|
||||
|
||||
$xaction->setHandles($this->getHandles());
|
||||
$view->setTitle($xaction->getTitleForFeed($this));
|
||||
$body = $xaction->getBodyForFeed($this);
|
||||
|
||||
foreach ($xaction_phids as $xaction_phid) {
|
||||
$secondary_xaction = $this->getObject($xaction_phid);
|
||||
$secondary_xaction->setHandles($this->getHandles());
|
||||
|
||||
$body = $secondary_xaction->getBodyForFeed($this);
|
||||
if (nonempty($body)) {
|
||||
$view->appendChild($body);
|
||||
}
|
||||
}
|
||||
|
||||
$view->setImage(
|
||||
$this->getHandle(
|
||||
$this->getPrimaryTransaction()->getAuthorPHID())->getImageURI());
|
||||
$this->getHandle($xaction->getAuthorPHID())->getImageURI());
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue