Commit 1d55b99c authored by Emanuele Aina's avatar Emanuele Aina Committed by Ana Rute Mendes

Derive story/mention time from transactions

By taking the story time from the transaction creation date we ensure that the times reported in the feed view match the ones reported in the item-specific change lists.
parent 530c6484
......@@ -2131,8 +2131,10 @@ abstract class PhabricatorApplicationTransactionEditor
if ($mentionable_phids) {
$edge_type = PhabricatorObjectMentionsObjectEdgeType::EDGECONST;
$date = head($xactions)->getDateCreated();
$block_xactions[] = newv(get_class(head($xactions)), array())
->setIgnoreOnNoEffect(true)
->setDateCreated($date)
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
->setMetadataValue('edge:type', $edge_type)
->setNewValue(array('+' => $mentionable_phids));
......@@ -3700,6 +3702,19 @@ abstract class PhabricatorApplicationTransactionEditor
}
/**
* @task feed
*/
protected function getFeedStoryTime(array $xactions) {
$xactions = msort($xactions, 'getActionStrength');
$xactions = array_reverse($xactions);
$date = head(nonempty(mpull($xactions, 'getDateCreated')));
return $date;
}
/**
* @task feed
*/
......@@ -3824,6 +3839,7 @@ abstract class PhabricatorApplicationTransactionEditor
$story_type = $this->getFeedStoryType();
$story_data = $this->getFeedStoryData($object, $xactions);
$story_time = $this->getFeedStoryTime($xactions);
$unexpandable_phids = $this->mailUnexpandablePHIDs;
if (!is_array($unexpandable_phids)) {
......@@ -3833,7 +3849,7 @@ abstract class PhabricatorApplicationTransactionEditor
id(new PhabricatorFeedStoryPublisher())
->setStoryType($story_type)
->setStoryData($story_data)
->setStoryTime(time())
->setStoryTime($story_time)
->setStoryAuthorPHID($this->getActingAsPHID())
->setRelatedPHIDs($related_phids)
->setPrimaryObjectPHID($object->getPHID())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment