From 58bbd6ee8838b9a4fabbd91c12295c44f51b9dbc Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 5 Feb 2021 08:13:35 -0800 Subject: [PATCH] Propagate the "ContextObject" to Remarkup rendering in timelines Summary: Ref T13602. Currently, timeline comment rendering does not (by default) propagate the context object to the rendering layer. This means that `@mentions` of users who can't see the object aren't rendered properly (currently: they show up as blue, but should show up as grey). Pass the context down the stack and into the remarkup engine. Test Plan: {F8382905} Maniphest Tasks: T13602 Differential Revision: https://secure.phabricator.com/D21548 --- .../engine/PhabricatorTimelineEngine.php | 1 + .../PhabricatorApplicationTransactionView.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/applications/transactions/engine/PhabricatorTimelineEngine.php b/src/applications/transactions/engine/PhabricatorTimelineEngine.php index c6c6cd44a4..2fa0b1451d 100644 --- a/src/applications/transactions/engine/PhabricatorTimelineEngine.php +++ b/src/applications/transactions/engine/PhabricatorTimelineEngine.php @@ -84,6 +84,7 @@ abstract class PhabricatorTimelineEngine return $view ->setViewer($viewer) + ->setObject($object) ->setObjectPHID($object->getPHID()) ->setTransactions($xactions); } diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php index 209b6baf64..ee2020f890 100644 --- a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php @@ -9,6 +9,7 @@ class PhabricatorApplicationTransactionView extends AphrontView { private $engine; private $showEditActions = true; private $isPreview; + private $object; private $objectPHID; private $shouldTerminate = false; private $quoteTargetID; @@ -41,6 +42,16 @@ class PhabricatorApplicationTransactionView extends AphrontView { return $this->quoteTargetID; } + public function setObject( + PhabricatorApplicationTransactionInterface $object) { + $this->object = $object; + return $this; + } + + private function getObject() { + return $this->object; + } + public function setObjectPHID($object_phid) { $this->objectPHID = $object_phid; return $this; @@ -238,6 +249,12 @@ class PhabricatorApplicationTransactionView extends AphrontView { $engine = id(new PhabricatorMarkupEngine()) ->setViewer($this->getViewer()); + + $object = $this->getObject(); + if ($object) { + $engine->setContextObject($object); + } + foreach ($this->transactions as $xaction) { if (!$xaction->hasComment()) { continue;