mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +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);
|
$phids = array_keys($phids);
|
||||||
$handles = $viewer->loadHandles($phids);
|
$handles = $viewer->loadHandles($phids);
|
||||||
|
|
||||||
$engine = id(new PhabricatorMarkupEngine())
|
|
||||||
->setViewer($viewer)
|
|
||||||
->setContextObject($task)
|
|
||||||
->addObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION);
|
|
||||||
|
|
||||||
$timeline = $this->buildTransactionTimeline(
|
$timeline = $this->buildTransactionTimeline(
|
||||||
$task,
|
$task,
|
||||||
new ManiphestTransactionQuery(),
|
new ManiphestTransactionQuery());
|
||||||
$engine);
|
|
||||||
|
|
||||||
$monogram = $task->getMonogram();
|
$monogram = $task->getMonogram();
|
||||||
$crumbs = $this->buildApplicationCrumbs()
|
$crumbs = $this->buildApplicationCrumbs()
|
||||||
|
@ -76,7 +70,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
||||||
|
|
||||||
$header = $this->buildHeaderView($task);
|
$header = $this->buildHeaderView($task);
|
||||||
$details = $this->buildPropertyView($task, $field_list, $edges, $handles);
|
$details = $this->buildPropertyView($task, $field_list, $edges, $handles);
|
||||||
$description = $this->buildDescriptionView($task, $engine);
|
$description = $this->buildDescriptionView($task);
|
||||||
$curtain = $this->buildCurtain($task, $edit_engine);
|
$curtain = $this->buildCurtain($task, $edit_engine);
|
||||||
|
|
||||||
$title = pht('%s %s', $monogram, $task->getTitle());
|
$title = pht('%s %s', $monogram, $task->getTitle());
|
||||||
|
@ -346,12 +340,13 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildDescriptionView(
|
private function buildDescriptionView(ManiphestTask $task) {
|
||||||
ManiphestTask $task,
|
$viewer = $this->getViewer();
|
||||||
PhabricatorMarkupEngine $engine) {
|
|
||||||
|
|
||||||
$section = null;
|
$section = null;
|
||||||
if (strlen($task->getDescription())) {
|
|
||||||
|
$description = $task->getDescription();
|
||||||
|
if (strlen($description)) {
|
||||||
$section = new PHUIPropertyListView();
|
$section = new PHUIPropertyListView();
|
||||||
$section->addTextContent(
|
$section->addTextContent(
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
|
@ -359,7 +354,8 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
||||||
array(
|
array(
|
||||||
'class' => 'phabricator-remarkup',
|
'class' => 'phabricator-remarkup',
|
||||||
),
|
),
|
||||||
$engine->getOutput($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION)));
|
id(new PHUIRemarkupView($viewer, $description))
|
||||||
|
->setContextObject($task)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $section;
|
return $section;
|
||||||
|
|
|
@ -13,6 +13,7 @@ final class PHUIRemarkupView extends AphrontView {
|
||||||
|
|
||||||
private $corpus;
|
private $corpus;
|
||||||
private $markupType;
|
private $markupType;
|
||||||
|
private $contextObject;
|
||||||
|
|
||||||
const DOCUMENT = 'document';
|
const DOCUMENT = 'document';
|
||||||
|
|
||||||
|
@ -26,16 +27,27 @@ final class PHUIRemarkupView extends AphrontView {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setContextObject($context_object) {
|
||||||
|
$this->contextObject = $context_object;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContextObject() {
|
||||||
|
return $this->contextObject;
|
||||||
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
$viewer = $this->getUser();
|
$viewer = $this->getUser();
|
||||||
$corpus = $this->corpus;
|
$corpus = $this->corpus;
|
||||||
|
$context = $this->getContextObject();
|
||||||
|
|
||||||
$content = PhabricatorMarkupEngine::renderOneObject(
|
$content = PhabricatorMarkupEngine::renderOneObject(
|
||||||
id(new PhabricatorMarkupOneOff())
|
id(new PhabricatorMarkupOneOff())
|
||||||
->setPreserveLinebreaks(true)
|
->setPreserveLinebreaks(true)
|
||||||
->setContent($corpus),
|
->setContent($corpus),
|
||||||
'default',
|
'default',
|
||||||
$viewer);
|
$viewer,
|
||||||
|
$context);
|
||||||
|
|
||||||
if ($this->markupType == self::DOCUMENT) {
|
if ($this->markupType == self::DOCUMENT) {
|
||||||
return phutil_tag(
|
return phutil_tag(
|
||||||
|
|
Loading…
Reference in a new issue