diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index ceda169489..285f919ce8 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -59,15 +59,9 @@ final class ManiphestTaskDetailController extends ManiphestController { $phids = array_keys($phids); $handles = $viewer->loadHandles($phids); - $engine = id(new PhabricatorMarkupEngine()) - ->setViewer($viewer) - ->setContextObject($task) - ->addObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION); - $timeline = $this->buildTransactionTimeline( $task, - new ManiphestTransactionQuery(), - $engine); + new ManiphestTransactionQuery()); $monogram = $task->getMonogram(); $crumbs = $this->buildApplicationCrumbs() @@ -76,7 +70,7 @@ final class ManiphestTaskDetailController extends ManiphestController { $header = $this->buildHeaderView($task); $details = $this->buildPropertyView($task, $field_list, $edges, $handles); - $description = $this->buildDescriptionView($task, $engine); + $description = $this->buildDescriptionView($task); $curtain = $this->buildCurtain($task, $edit_engine); $title = pht('%s %s', $monogram, $task->getTitle()); @@ -346,12 +340,13 @@ final class ManiphestTaskDetailController extends ManiphestController { return null; } - private function buildDescriptionView( - ManiphestTask $task, - PhabricatorMarkupEngine $engine) { + private function buildDescriptionView(ManiphestTask $task) { + $viewer = $this->getViewer(); $section = null; - if (strlen($task->getDescription())) { + + $description = $task->getDescription(); + if (strlen($description)) { $section = new PHUIPropertyListView(); $section->addTextContent( phutil_tag( @@ -359,7 +354,8 @@ final class ManiphestTaskDetailController extends ManiphestController { array( 'class' => 'phabricator-remarkup', ), - $engine->getOutput($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION))); + id(new PHUIRemarkupView($viewer, $description)) + ->setContextObject($task))); } return $section; diff --git a/src/infrastructure/markup/view/PHUIRemarkupView.php b/src/infrastructure/markup/view/PHUIRemarkupView.php index 8a8d9ddf7f..0a07e64a87 100644 --- a/src/infrastructure/markup/view/PHUIRemarkupView.php +++ b/src/infrastructure/markup/view/PHUIRemarkupView.php @@ -13,6 +13,7 @@ final class PHUIRemarkupView extends AphrontView { private $corpus; private $markupType; + private $contextObject; const DOCUMENT = 'document'; @@ -26,16 +27,27 @@ final class PHUIRemarkupView extends AphrontView { return $this; } + public function setContextObject($context_object) { + $this->contextObject = $context_object; + return $this; + } + + public function getContextObject() { + return $this->contextObject; + } + public function render() { $viewer = $this->getUser(); $corpus = $this->corpus; + $context = $this->getContextObject(); $content = PhabricatorMarkupEngine::renderOneObject( id(new PhabricatorMarkupOneOff()) ->setPreserveLinebreaks(true) ->setContent($corpus), 'default', - $viewer); + $viewer, + $context); if ($this->markupType == self::DOCUMENT) { return phutil_tag(