@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.

Update to use PHUIRemarkupView everywhere possible

Summary: Moves all the one off object calls to PHUIRemarkupView, adds a "Document" call as well (future plans).

Test Plan: Visited most pages I could get access to, but may want extra careful eyes on this diff.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15281

+81 -197
+1 -5
src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
··· 363 363 ->getIconLabel($event->getIcon())); 364 364 365 365 if (strlen($event->getDescription())) { 366 - $description = PhabricatorMarkupEngine::renderOneObject( 367 - id(new PhabricatorMarkupOneOff())->setContent($event->getDescription()), 368 - 'default', 369 - $viewer); 370 - 366 + $description = new PHUIRemarkupView($viewer, $event->getDescription()); 371 367 $properties->addSectionHeader( 372 368 pht('Description'), 373 369 PHUIPropertyListView::ICON_SUMMARY);
+7 -19
src/applications/config/controller/PhabricatorConfigWelcomeController.php
··· 341 341 $header = id(new PHUIHeaderView()) 342 342 ->setHeader(pht('Welcome to Phabricator')); 343 343 344 - $setup_header = PhabricatorMarkupEngine::renderOneObject( 345 - id(new PhabricatorMarkupOneOff()) 346 - ->setContent(pht('=Setup and Configuration')), 347 - 'default', 348 - $viewer); 344 + $setup_header = new PHUIRemarkupView( 345 + $viewer, pht('=Setup and Configuration')); 349 346 350 - $explore_header = PhabricatorMarkupEngine::renderOneObject( 351 - id(new PhabricatorMarkupOneOff()) 352 - ->setContent(pht('=Explore Phabricator')), 353 - 'default', 354 - $viewer); 347 + $explore_header = new PHUIRemarkupView( 348 + $viewer, pht('=Explore Phabricator')); 355 349 356 - $quick_header = PhabricatorMarkupEngine::renderOneObject( 357 - id(new PhabricatorMarkupOneOff()) 358 - ->setContent(pht('=Quick Start Guides')), 359 - 'default', 360 - $viewer); 350 + $quick_header = new PHUIRemarkupView( 351 + $viewer, pht('=Quick Start Guide')); 361 352 362 353 return id(new PHUIDocumentView()) 363 354 ->setHeader($header) ··· 376 367 $icon = id(new PHUIIconView()) 377 368 ->setIcon($icon.' fa-2x'); 378 369 379 - $content = PhabricatorMarkupEngine::renderOneObject( 380 - id(new PhabricatorMarkupOneOff())->setContent($content), 381 - 'default', 382 - $viewer); 370 + $content = new PHUIRemarkupView($viewer, $content); 383 371 384 372 $icon = phutil_tag( 385 373 'div',
+1 -5
src/applications/countdown/controller/PhabricatorCountdownViewController.php
··· 132 132 133 133 $description = $countdown->getDescription(); 134 134 if (strlen($description)) { 135 - $description = PhabricatorMarkupEngine::renderOneObject( 136 - id(new PhabricatorMarkupOneOff())->setContent($description), 137 - 'default', 138 - $viewer); 139 - 135 + $description = new PHUIRemarkupView($viewer, $description); 140 136 $view->addSectionHeader( 141 137 pht('Description'), 142 138 PHUIPropertyListView::ICON_SUMMARY);
+1 -6
src/applications/differential/customfield/DifferentialRevertPlanField.php
··· 44 44 return null; 45 45 } 46 46 47 - return PhabricatorMarkupEngine::renderOneObject( 48 - id(new PhabricatorMarkupOneOff()) 49 - ->setPreserveLinebreaks(true) 50 - ->setContent($this->getValue()), 51 - 'default', 52 - $this->getViewer()); 47 + return new PHUIRemarkupView($this->getViewer(), $this->getValue()); 53 48 } 54 49 55 50 public function shouldAppearInGlobalSearch() {
+1 -6
src/applications/differential/customfield/DifferentialSummaryField.php
··· 122 122 return null; 123 123 } 124 124 125 - return PhabricatorMarkupEngine::renderOneObject( 126 - id(new PhabricatorMarkupOneOff()) 127 - ->setPreserveLinebreaks(true) 128 - ->setContent($this->getValue()), 129 - 'default', 130 - $this->getViewer()); 125 + return new PHUIRemarkupView($this->getViewer(), $this->getValue()); 131 126 } 132 127 133 128 public function getApplicationTransactionRemarkupBlocks(
+1 -6
src/applications/differential/customfield/DifferentialTestPlanField.php
··· 136 136 return null; 137 137 } 138 138 139 - return PhabricatorMarkupEngine::renderOneObject( 140 - id(new PhabricatorMarkupOneOff()) 141 - ->setPreserveLinebreaks(true) 142 - ->setContent($this->getValue()), 143 - 'default', 144 - $this->getViewer()); 139 + return new PHUIRemarkupView($this->getViewer(), $this->getValue()); 145 140 } 146 141 147 142 public function getApplicationTransactionRemarkupBlocks(
+1 -4
src/applications/diffusion/controller/DiffusionRepositoryController.php
··· 290 290 291 291 $description = $repository->getDetail('description'); 292 292 if (strlen($description)) { 293 - $description = PhabricatorMarkupEngine::renderOneObject( 294 - $repository, 295 - 'description', 296 - $user); 293 + $description = new PHUIRemarkupView($user, $description); 297 294 $view->addSectionHeader( 298 295 pht('Description'), PHUIPropertyListView::ICON_SUMMARY); 299 296 $view->addTextContent($description);
+1 -4
src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
··· 309 309 if (!strlen($description)) { 310 310 $description = phutil_tag('em', array(), pht('No description provided.')); 311 311 } else { 312 - $description = PhabricatorMarkupEngine::renderOneObject( 313 - $repository, 314 - 'description', 315 - $viewer); 312 + $description = new PHUIRemarkupView($viewer, $description); 316 313 } 317 314 $view->addTextContent($description); 318 315
+1 -5
src/applications/diviner/controller/DivinerBookController.php
··· 94 94 $preface = $book->getPreface(); 95 95 $preface_view = null; 96 96 if (strlen($preface)) { 97 - $preface_view = 98 - PhabricatorMarkupEngine::renderOneObject( 99 - id(new PhabricatorMarkupOneOff())->setContent($preface), 100 - 'default', 101 - $viewer); 97 + $preface_view = new PHUIRemarkupView($viewer, $preface); 102 98 } 103 99 104 100 $document->appendChild($preface_view);
+1 -5
src/applications/diviner/controller/DivinerMainController.php
··· 61 61 " %s\n\n", 62 62 'phabricator/ $ ./bin/diviner generate'); 63 63 64 - $text = PhabricatorMarkupEngine::renderOneObject( 65 - id(new PhabricatorMarkupOneOff())->setContent($text), 66 - 'default', 67 - $viewer); 68 - 64 + $text = new PHUIRemarkupView($viewer, $text); 69 65 $document->appendChild($text); 70 66 } 71 67
+2 -8
src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php
··· 111 111 "The Asana Workspaces your linked account has access to are:\n\n%s", 112 112 $out); 113 113 114 - return PhabricatorMarkupEngine::renderOneObject( 115 - id(new PhabricatorMarkupOneOff())->setContent($out), 116 - 'default', 117 - $viewer); 114 + return new PHUIRemarkupView($viewer, $out); 118 115 } 119 116 120 117 private function renderContextualProjectDescription( ··· 155 152 156 153 $out = implode("\n", $out); 157 154 158 - return PhabricatorMarkupEngine::renderOneObject( 159 - id(new PhabricatorMarkupOneOff())->setContent($out), 160 - 'default', 161 - $viewer); 155 + return new PHUIRemarkupView($viewer, $out); 162 156 } 163 157 164 158 }
+2 -10
src/applications/fund/controller/FundInitiativeViewController.php
··· 98 98 99 99 $description = $initiative->getDescription(); 100 100 if (strlen($description)) { 101 - $description = PhabricatorMarkupEngine::renderOneObject( 102 - id(new PhabricatorMarkupOneOff())->setContent($description), 103 - 'default', 104 - $viewer); 105 - 101 + $description = new PHUIRemarkupView($viewer, $description); 106 102 $view->addSectionHeader( 107 103 pht('Description'), PHUIPropertyListView::ICON_SUMMARY); 108 104 $view->addTextContent($description); ··· 110 106 111 107 $risks = $initiative->getRisks(); 112 108 if (strlen($risks)) { 113 - $risks = PhabricatorMarkupEngine::renderOneObject( 114 - id(new PhabricatorMarkupOneOff())->setContent($risks), 115 - 'default', 116 - $viewer); 117 - 109 + $risks = new PHUIRemarkupView($viewer, $risks); 118 110 $view->addSectionHeader( 119 111 pht('Risks/Challenges'), 'fa-ambulance'); 120 112 $view->addTextContent($risks);
+2 -8
src/applications/harbormaster/controller/HarbormasterBuildViewController.php
··· 181 181 if ($step) { 182 182 $description = $step->getDescription(); 183 183 if ($description) { 184 - $rendered = PhabricatorMarkupEngine::renderOneObject( 185 - id(new PhabricatorMarkupOneOff()) 186 - ->setContent($description) 187 - ->setPreserveLinebreaks(true), 188 - 'default', 189 - $viewer); 190 - 184 + $description = new PHUIRemarkupView($viewer, $description); 191 185 $properties->addSectionHeader( 192 186 pht('Description'), PHUIPropertyListView::ICON_SUMMARY); 193 - $properties->addTextContent($rendered); 187 + $properties->addTextContent($description); 194 188 } 195 189 } else { 196 190 $target_box->setFormErrors(
+1 -5
src/applications/legalpad/controller/LegalpadDocumentSignController.php
··· 258 258 259 259 $preamble_box = null; 260 260 if (strlen($document->getPreamble())) { 261 - $preamble_text = PhabricatorMarkupEngine::renderOneObject( 262 - id(new PhabricatorMarkupOneOff())->setContent( 263 - $document->getPreamble()), 264 - 'default', 265 - $viewer); 261 + $preamble_text = new PHUIRemarkupView($viewer, $document->getPreamble()); 266 262 267 263 // NOTE: We're avoiding `setObject()` here so we don't pick up extra UI 268 264 // elements like "Subscribers". This information is available on the
+3 -6
src/applications/meta/controller/PhabricatorApplicationDetailViewController.php
··· 104 104 } 105 105 106 106 $overview = $application->getOverview(); 107 - if ($overview) { 107 + if (strlen($overview)) { 108 + $overview = new PHUIRemarkupView($viewer, $overview); 108 109 $properties->addSectionHeader( 109 110 pht('Overview'), PHUIPropertyListView::ICON_SUMMARY); 110 - $properties->addTextContent( 111 - PhabricatorMarkupEngine::renderOneObject( 112 - id(new PhabricatorMarkupOneOff())->setContent($overview), 113 - 'default', 114 - $viewer)); 111 + $properties->addTextContent($overview); 115 112 } 116 113 117 114 $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
+1 -4
src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php
··· 117 117 $crumbs->addTextCrumb($title); 118 118 $crumbs->setBorder(true); 119 119 120 - $content_box = PhabricatorMarkupEngine::renderOneObject( 121 - id(new PhabricatorMarkupOneOff())->setContent($content), 122 - 'default', 123 - $viewer); 120 + $content_box = new PHUIRemarkupView($viewer, $content); 124 121 125 122 $info_view = null; 126 123 if (!PhabricatorEnv::getEnvConfig('metamta.reply-handler-domain')) {
+1 -5
src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php
··· 120 120 PHUIPropertyListView $view) { 121 121 122 122 $complaint = $item->getNuanceProperty('complaint'); 123 - $complaint = PhabricatorMarkupEngine::renderOneObject( 124 - id(new PhabricatorMarkupOneOff())->setContent($complaint), 125 - 'default', 126 - $viewer); 127 - 123 + $complaint = new PHUIRemarkupView($viewer, $complaint); 128 124 $view->addSectionHeader( 129 125 pht('Complaint'), 'fa-exclamation-circle'); 130 126 $view->addTextContent($complaint);
+2 -5
src/applications/owners/controller/PhabricatorOwnersDetailController.php
··· 189 189 190 190 $description = $package->getDescription(); 191 191 if (strlen($description)) { 192 + $description = new PHUIRemarkupView($viewer, $description); 192 193 $view->addSectionHeader( 193 194 pht('Description'), PHUIPropertyListView::ICON_SUMMARY); 194 - $view->addTextContent( 195 - $output = PhabricatorMarkupEngine::renderOneObject( 196 - id(new PhabricatorMarkupOneOff())->setContent($description), 197 - 'default', 198 - $viewer)); 195 + $view->addTextContent($description); 199 196 } 200 197 201 198 $view->invokeWillRenderEvent();
+1 -4
src/applications/phame/controller/blog/PhameBlogManageController.php
··· 118 118 $properties->invokeWillRenderEvent(); 119 119 120 120 if (strlen($blog->getDescription())) { 121 - $description = PhabricatorMarkupEngine::renderOneObject( 122 - id(new PhabricatorMarkupOneOff())->setContent($blog->getDescription()), 123 - 'default', 124 - $viewer); 121 + $description = new PHUIRemarkupView($viewer, $description); 125 122 $properties->addSectionHeader( 126 123 pht('Description'), 127 124 PHUIPropertyListView::ICON_SUMMARY);
+2 -5
src/applications/pholio/controller/PholioInlineController.php
··· 86 86 ), 87 87 $author_handle->renderLink()); 88 88 89 + $inline_content = new PHUIRemarkupView($viewer, $inline->getContent()); 89 90 $comment_body = phutil_tag( 90 91 'div', 91 92 array( 92 93 'class' => 'pholio-inline-comment-body', 93 94 ), 94 - PhabricatorMarkupEngine::renderOneObject( 95 - id(new PhabricatorMarkupOneOff()) 96 - ->setContent($inline->getContent()), 97 - 'default', 98 - $viewer)); 95 + $inline_content); 99 96 100 97 return $this->newDialog() 101 98 ->setTitle(pht('Inline Comment'))
+1 -6
src/applications/phortune/controller/PhortuneCartController.php
··· 48 48 return null; 49 49 } 50 50 51 - $output = PhabricatorMarkupEngine::renderOneObject( 52 - id(new PhabricatorMarkupOneOff()) 53 - ->setPreserveLinebreaks(true) 54 - ->setContent($description), 55 - 'default', 56 - $this->getViewer()); 51 + $output = new PHUIRemarkupView($this->getUser(), $description); 57 52 58 53 $box = id(new PHUIBoxView()) 59 54 ->addMargin(PHUI::MARGIN_LARGE)
+1 -5
src/applications/phortune/controller/PhortuneMerchantViewController.php
··· 136 136 137 137 $description = $merchant->getDescription(); 138 138 if (strlen($description)) { 139 - $description = PhabricatorMarkupEngine::renderOneObject( 140 - id(new PhabricatorMarkupOneOff())->setContent($description), 141 - 'default', 142 - $viewer); 143 - 139 + $description = new PHUIRemarkupView($viewer, $description); 144 140 $view->addSectionHeader( 145 141 pht('Description'), PHUIPropertyListView::ICON_SUMMARY); 146 142 $view->addTextContent($description);
+3 -7
src/applications/phurl/controller/PhabricatorPhurlURLViewController.php
··· 134 134 135 135 $properties->invokeWillRenderEvent(); 136 136 137 - if (strlen($url->getDescription())) { 138 - $description = PhabricatorMarkupEngine::renderOneObject( 139 - id(new PhabricatorMarkupOneOff())->setContent($url->getDescription()), 140 - 'default', 141 - $viewer); 142 - 137 + $description = $url->getDescription(); 138 + if (strlen($description)) { 139 + $description = new PHUIRemarkupView($viewer, $description); 143 140 $properties->addSectionHeader( 144 141 pht('Description'), 145 142 PHUIPropertyListView::ICON_SUMMARY); 146 - 147 143 $properties->addTextContent($description); 148 144 } 149 145
+7 -7
src/applications/slowvote/controller/PhabricatorSlowvotePollController.php
··· 122 122 123 123 $view->invokeWillRenderEvent(); 124 124 125 - if (strlen($poll->getDescription())) { 126 - $view->addTextContent( 127 - $output = PhabricatorMarkupEngine::renderOneObject( 128 - id(new PhabricatorMarkupOneOff())->setContent( 129 - $poll->getDescription()), 130 - 'default', 131 - $viewer)); 125 + $description = $poll->getDescription(); 126 + if (strlen($description)) { 127 + $description = new PHUIRemarkupView($viewer, $description); 128 + $view->addSectionHeader( 129 + pht('Description'), 130 + PHUIPropertyListView::ICON_SUMMARY); 131 + $view->addTextContent($description); 132 132 } 133 133 134 134 return $view;
+3 -7
src/applications/slowvote/view/SlowvoteEmbedView.php
··· 74 74 $header = id(new PHUIHeaderView()) 75 75 ->setHeader($link_to_slowvote); 76 76 77 - $description = null; 78 - if ($poll->getDescription()) { 79 - $description = PhabricatorMarkupEngine::renderOneObject( 80 - id(new PhabricatorMarkupOneOff())->setContent( 81 - $poll->getDescription()), 82 - 'default', 83 - $this->getUser()); 77 + $description = $poll->getDescription(); 78 + if (strlen($description)) { 79 + $description = new PHUIRemarkupView($this->getUser(), $description); 84 80 $description = phutil_tag( 85 81 'div', 86 82 array(
+1 -6
src/applications/spaces/controller/PhabricatorSpacesViewController.php
··· 83 83 84 84 $description = $space->getDescription(); 85 85 if (strlen($description)) { 86 - $description = PhabricatorMarkupEngine::renderOneObject( 87 - id(new PhabricatorMarkupOneOff())->setContent($description), 88 - 'default', 89 - $viewer); 90 - 86 + $description = new PHUIRemarkupView($viewer, $description); 91 87 $list->addSectionHeader( 92 88 pht('Description'), 93 89 PHUIPropertyListView::ICON_SUMMARY); 94 - 95 90 $list->addTextContent($description); 96 91 } 97 92
+1 -4
src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php
··· 50 50 $details_text = pht( 51 51 'For full details, run `/bin/mail show-outbound --id %d`', 52 52 $source_id); 53 - $addendum = PhabricatorMarkupEngine::renderOneObject( 54 - id(new PhabricatorMarkupOneOff())->setContent($details_text), 55 - 'default', 56 - $viewer); 53 + $addendum = new PHUIRemarkupView($viewer, $details_text); 57 54 } 58 55 } 59 56 }
+1 -5
src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php
··· 121 121 } 122 122 123 123 $content = implode("\n\n", $content); 124 - 125 - $content_box = PhabricatorMarkupEngine::renderOneObject( 126 - id(new PhabricatorMarkupOneOff())->setContent($content), 127 - 'default', 128 - $viewer); 124 + $content_box = new PHUIRemarkupView($viewer, $content); 129 125 130 126 $header = id(new PHUIHeaderView()) 131 127 ->setHeader($title);
+1 -4
src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php
··· 40 40 EOCONTENT 41 41 ); 42 42 43 - $remarkup = PhabricatorMarkupEngine::renderOneObject( 44 - id(new PhabricatorMarkupOneOff())->setContent($content), 45 - 'default', 46 - $viewer); 43 + $remarkup = new PHUIRemarkupView($viewer, $content); 47 44 48 45 $frame = id(new PHUIBoxView()) 49 46 ->addPadding(PHUI::PADDING_LARGE)
+1 -6
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php
··· 39 39 // end of the world. 40 40 41 41 $viewer = $this->getViewer(); 42 - return PhabricatorMarkupEngine::renderOneObject( 43 - id(new PhabricatorMarkupOneOff()) 44 - ->setContent($value) 45 - ->setPReserveLinebreaks(true), 46 - 'default', 47 - $viewer); 42 + return new PHUIRemarkupView($viewer, $value); 48 43 } 49 44 50 45 public function getApplicationTransactionTitle(
+20 -1
src/infrastructure/markup/view/PHUIRemarkupView.php
··· 12 12 final class PHUIRemarkupView extends AphrontView { 13 13 14 14 private $corpus; 15 + private $markupType; 16 + 17 + const DOCUMENT = 'document'; 15 18 16 19 public function __construct(PhabricatorUser $viewer, $corpus) { 17 20 $this->setUser($viewer); 18 21 $this->corpus = $corpus; 19 22 } 20 23 24 + private function setMarkupType($type) { 25 + $this->markupType($type); 26 + return $this; 27 + } 28 + 21 29 public function render() { 22 30 $viewer = $this->getUser(); 23 31 $corpus = $this->corpus; 24 32 25 - return PhabricatorMarkupEngine::renderOneObject( 33 + $content = PhabricatorMarkupEngine::renderOneObject( 26 34 id(new PhabricatorMarkupOneOff()) 27 35 ->setPreserveLinebreaks(true) 28 36 ->setContent($corpus), 29 37 'default', 30 38 $viewer); 39 + 40 + if ($this->markupType == self::DOCUMENT) { 41 + return phutil_tag( 42 + 'div', 43 + array( 44 + 'class' => 'phabricator-remarkup phui-document-view', 45 + ), 46 + $content); 47 + } 48 + 49 + return $content; 31 50 } 32 51 33 52 }
+2 -4
src/view/form/AphrontFormView.php
··· 85 85 86 86 public function appendRemarkupInstructions($remarkup) { 87 87 return $this->appendInstructions( 88 - PhabricatorMarkupEngine::renderOneObject( 89 - id(new PhabricatorMarkupOneOff())->setContent($remarkup), 90 - 'default', 91 - $this->getUser())); 88 + new PHUIRemarkupView($this->getUser(), $remarkup)); 89 + 92 90 } 93 91 94 92 public function buildLayoutView() {
+4 -5
src/view/form/PHUIFormLayoutView.php
··· 35 35 throw new PhutilInvalidStateException('setUser'); 36 36 } 37 37 38 - return $this->appendInstructions( 39 - PhabricatorMarkupEngine::renderOneObject( 40 - id(new PhabricatorMarkupOneOff())->setContent($remarkup), 41 - 'default', 42 - $this->getUser())); 38 + $viewer = $this->getUser(); 39 + $instructions = new PHUIRemarkupView($viewer, $remarkup); 40 + 41 + return $this->appendInstructions($instructions); 43 42 } 44 43 45 44 public function render() {
+2 -5
src/view/form/PHUIFormPageView.php
··· 74 74 } 75 75 76 76 public function addRemarkupInstructions($remarkup, $before = null) { 77 - return $this->addInstructions( 78 - PhabricatorMarkupEngine::renderOneObject( 79 - id(new PhabricatorMarkupOneOff())->setContent($remarkup), 80 - 'default', 81 - $this->getUser()), $before); 77 + $remarkup = new PHUIRemarkupView($this->getUser(), $remarkup); 78 + return $this->addInstructions($remarkup, $before); 82 79 } 83 80 84 81 public function addControl(AphrontFormControl $control) {