1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

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
This commit is contained in:
epriestley 2021-02-05 08:13:35 -08:00
parent a4cb2bb772
commit 58bbd6ee88
2 changed files with 18 additions and 0 deletions

View file

@ -84,6 +84,7 @@ abstract class PhabricatorTimelineEngine
return $view return $view
->setViewer($viewer) ->setViewer($viewer)
->setObject($object)
->setObjectPHID($object->getPHID()) ->setObjectPHID($object->getPHID())
->setTransactions($xactions); ->setTransactions($xactions);
} }

View file

@ -9,6 +9,7 @@ class PhabricatorApplicationTransactionView extends AphrontView {
private $engine; private $engine;
private $showEditActions = true; private $showEditActions = true;
private $isPreview; private $isPreview;
private $object;
private $objectPHID; private $objectPHID;
private $shouldTerminate = false; private $shouldTerminate = false;
private $quoteTargetID; private $quoteTargetID;
@ -41,6 +42,16 @@ class PhabricatorApplicationTransactionView extends AphrontView {
return $this->quoteTargetID; return $this->quoteTargetID;
} }
public function setObject(
PhabricatorApplicationTransactionInterface $object) {
$this->object = $object;
return $this;
}
private function getObject() {
return $this->object;
}
public function setObjectPHID($object_phid) { public function setObjectPHID($object_phid) {
$this->objectPHID = $object_phid; $this->objectPHID = $object_phid;
return $this; return $this;
@ -238,6 +249,12 @@ class PhabricatorApplicationTransactionView extends AphrontView {
$engine = id(new PhabricatorMarkupEngine()) $engine = id(new PhabricatorMarkupEngine())
->setViewer($this->getViewer()); ->setViewer($this->getViewer());
$object = $this->getObject();
if ($object) {
$engine->setContextObject($object);
}
foreach ($this->transactions as $xaction) { foreach ($this->transactions as $xaction) {
if (!$xaction->hasComment()) { if (!$xaction->hasComment()) {
continue; continue;