@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+22 -14
+9 -13
src/applications/maniphest/controller/ManiphestTaskDetailController.php
··· 59 59 $phids = array_keys($phids); 60 60 $handles = $viewer->loadHandles($phids); 61 61 62 - $engine = id(new PhabricatorMarkupEngine()) 63 - ->setViewer($viewer) 64 - ->setContextObject($task) 65 - ->addObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION); 66 - 67 62 $timeline = $this->buildTransactionTimeline( 68 63 $task, 69 - new ManiphestTransactionQuery(), 70 - $engine); 64 + new ManiphestTransactionQuery()); 71 65 72 66 $monogram = $task->getMonogram(); 73 67 $crumbs = $this->buildApplicationCrumbs() ··· 76 70 77 71 $header = $this->buildHeaderView($task); 78 72 $details = $this->buildPropertyView($task, $field_list, $edges, $handles); 79 - $description = $this->buildDescriptionView($task, $engine); 73 + $description = $this->buildDescriptionView($task); 80 74 $curtain = $this->buildCurtain($task, $edit_engine); 81 75 82 76 $title = pht('%s %s', $monogram, $task->getTitle()); ··· 346 340 return null; 347 341 } 348 342 349 - private function buildDescriptionView( 350 - ManiphestTask $task, 351 - PhabricatorMarkupEngine $engine) { 343 + private function buildDescriptionView(ManiphestTask $task) { 344 + $viewer = $this->getViewer(); 352 345 353 346 $section = null; 354 - if (strlen($task->getDescription())) { 347 + 348 + $description = $task->getDescription(); 349 + if (strlen($description)) { 355 350 $section = new PHUIPropertyListView(); 356 351 $section->addTextContent( 357 352 phutil_tag( ··· 359 354 array( 360 355 'class' => 'phabricator-remarkup', 361 356 ), 362 - $engine->getOutput($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION))); 357 + id(new PHUIRemarkupView($viewer, $description)) 358 + ->setContextObject($task))); 363 359 } 364 360 365 361 return $section;
+13 -1
src/infrastructure/markup/view/PHUIRemarkupView.php
··· 13 13 14 14 private $corpus; 15 15 private $markupType; 16 + private $contextObject; 16 17 17 18 const DOCUMENT = 'document'; 18 19 ··· 26 27 return $this; 27 28 } 28 29 30 + public function setContextObject($context_object) { 31 + $this->contextObject = $context_object; 32 + return $this; 33 + } 34 + 35 + public function getContextObject() { 36 + return $this->contextObject; 37 + } 38 + 29 39 public function render() { 30 40 $viewer = $this->getUser(); 31 41 $corpus = $this->corpus; 42 + $context = $this->getContextObject(); 32 43 33 44 $content = PhabricatorMarkupEngine::renderOneObject( 34 45 id(new PhabricatorMarkupOneOff()) 35 46 ->setPreserveLinebreaks(true) 36 47 ->setContent($corpus), 37 48 'default', 38 - $viewer); 49 + $viewer, 50 + $context); 39 51 40 52 if ($this->markupType == self::DOCUMENT) { 41 53 return phutil_tag(