Commit 745775ca authored by Emanuele Aina's avatar Emanuele Aina Committed by Ana Rute Mendes
Browse files

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 3643cd1f
...@@ -2131,8 +2131,10 @@ abstract class PhabricatorApplicationTransactionEditor ...@@ -2131,8 +2131,10 @@ abstract class PhabricatorApplicationTransactionEditor
if ($mentionable_phids) { if ($mentionable_phids) {
$edge_type = PhabricatorObjectMentionsObjectEdgeType::EDGECONST; $edge_type = PhabricatorObjectMentionsObjectEdgeType::EDGECONST;
$date = head($xactions)->getDateCreated();
$block_xactions[] = newv(get_class(head($xactions)), array()) $block_xactions[] = newv(get_class(head($xactions)), array())
->setIgnoreOnNoEffect(true) ->setIgnoreOnNoEffect(true)
->setDateCreated($date)
->setTransactionType(PhabricatorTransactions::TYPE_EDGE) ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
->setMetadataValue('edge:type', $edge_type) ->setMetadataValue('edge:type', $edge_type)
->setNewValue(array('+' => $mentionable_phids)); ->setNewValue(array('+' => $mentionable_phids));
...@@ -3700,6 +3702,19 @@ abstract class PhabricatorApplicationTransactionEditor ...@@ -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 * @task feed
*/ */
...@@ -3824,6 +3839,7 @@ abstract class PhabricatorApplicationTransactionEditor ...@@ -3824,6 +3839,7 @@ abstract class PhabricatorApplicationTransactionEditor
$story_type = $this->getFeedStoryType(); $story_type = $this->getFeedStoryType();
$story_data = $this->getFeedStoryData($object, $xactions); $story_data = $this->getFeedStoryData($object, $xactions);
$story_time = $this->getFeedStoryTime($xactions);
$unexpandable_phids = $this->mailUnexpandablePHIDs; $unexpandable_phids = $this->mailUnexpandablePHIDs;
if (!is_array($unexpandable_phids)) { if (!is_array($unexpandable_phids)) {
...@@ -3833,7 +3849,7 @@ abstract class PhabricatorApplicationTransactionEditor ...@@ -3833,7 +3849,7 @@ abstract class PhabricatorApplicationTransactionEditor
id(new PhabricatorFeedStoryPublisher()) id(new PhabricatorFeedStoryPublisher())
->setStoryType($story_type) ->setStoryType($story_type)
->setStoryData($story_data) ->setStoryData($story_data)
->setStoryTime(time()) ->setStoryTime($story_time)
->setStoryAuthorPHID($this->getActingAsPHID()) ->setStoryAuthorPHID($this->getActingAsPHID())
->setRelatedPHIDs($related_phids) ->setRelatedPHIDs($related_phids)
->setPrimaryObjectPHID($object->getPHID()) ->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