mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
Fix unusual use of Remarkup in Maniphest
Summary: Fixes T10234. This usage is unusual, out of date, and has some bad interactions with engines and custom rules. Test Plan: - Added `CustomInlineCodeRule` from P1129 as an extension rule. - Put a custom `<code> ... </code>` block in a Maniphest task description. - Saw fatal as described in task; applied change; saw rule work properly. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10234 Differential Revision: https://secure.phabricator.com/D15501
This commit is contained in:
parent
63ab2ad69b
commit
66946c0996
2 changed files with 22 additions and 14 deletions
|
@ -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;
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue