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

Change PhabricatorPhurlURLViewController to use EditEngine for commenting

Test Plan: Created a phurl, added some comments, confirmed that "Change Subscribers" and "Change Project Tags" are now available in the comment form.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: chad, Korvin

Maniphest Tasks: T11661

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

+11 -81
-2
src/__phutil_library_map__.php
··· 3445 3445 'PhabricatorPhurlURL' => 'applications/phurl/storage/PhabricatorPhurlURL.php', 3446 3446 'PhabricatorPhurlURLAccessController' => 'applications/phurl/controller/PhabricatorPhurlURLAccessController.php', 3447 3447 'PhabricatorPhurlURLAliasTransaction' => 'applications/phurl/xaction/PhabricatorPhurlURLAliasTransaction.php', 3448 - 'PhabricatorPhurlURLCommentController' => 'applications/phurl/controller/PhabricatorPhurlURLCommentController.php', 3449 3448 'PhabricatorPhurlURLCreateCapability' => 'applications/phurl/capability/PhabricatorPhurlURLCreateCapability.php', 3450 3449 'PhabricatorPhurlURLDatasource' => 'applications/phurl/typeahead/PhabricatorPhurlURLDatasource.php', 3451 3450 'PhabricatorPhurlURLDescriptionTransaction' => 'applications/phurl/xaction/PhabricatorPhurlURLDescriptionTransaction.php', ··· 8711 8710 ), 8712 8711 'PhabricatorPhurlURLAccessController' => 'PhabricatorPhurlController', 8713 8712 'PhabricatorPhurlURLAliasTransaction' => 'PhabricatorPhurlURLTransactionType', 8714 - 'PhabricatorPhurlURLCommentController' => 'PhabricatorPhurlController', 8715 8713 'PhabricatorPhurlURLCreateCapability' => 'PhabricatorPolicyCapability', 8716 8714 'PhabricatorPhurlURLDatasource' => 'PhabricatorTypeaheadDatasource', 8717 8715 'PhabricatorPhurlURLDescriptionTransaction' => 'PhabricatorPhurlURLTransactionType',
-2
src/applications/phurl/application/PhabricatorPhurlApplication.php
··· 48 48 'url/' => array( 49 49 $this->getEditRoutePattern('edit/') 50 50 => 'PhabricatorPhurlURLEditController', 51 - 'comment/(?P<id>[1-9]\d*)/' 52 - => 'PhabricatorPhurlURLCommentController', 53 51 ), 54 52 ), 55 53 );
-63
src/applications/phurl/controller/PhabricatorPhurlURLCommentController.php
··· 1 - <?php 2 - 3 - final class PhabricatorPhurlURLCommentController 4 - extends PhabricatorPhurlController { 5 - 6 - public function handleRequest(AphrontRequest $request) { 7 - if (!$request->isFormPost()) { 8 - return new Aphront400Response(); 9 - } 10 - 11 - $viewer = $request->getViewer(); 12 - $id = $request->getURIData('id'); 13 - 14 - $is_preview = $request->isPreviewRequest(); 15 - $draft = PhabricatorDraft::buildFromRequest($request); 16 - 17 - $phurl = id(new PhabricatorPhurlURLQuery()) 18 - ->setViewer($viewer) 19 - ->withIDs(array($id)) 20 - ->executeOne(); 21 - if (!$phurl) { 22 - return new Aphront404Response(); 23 - } 24 - 25 - $view_uri = '/'.$phurl->getMonogram(); 26 - 27 - $xactions = array(); 28 - $xactions[] = id(new PhabricatorPhurlURLTransaction()) 29 - ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) 30 - ->attachComment( 31 - id(new PhabricatorPhurlURLTransactionComment()) 32 - ->setContent($request->getStr('comment'))); 33 - 34 - $editor = id(new PhabricatorPhurlURLEditor()) 35 - ->setActor($viewer) 36 - ->setContinueOnNoEffect($request->isContinueRequest()) 37 - ->setContentSourceFromRequest($request) 38 - ->setIsPreview($is_preview); 39 - 40 - try { 41 - $xactions = $editor->applyTransactions($phurl, $xactions); 42 - } catch (PhabricatorApplicationTransactionNoEffectException $ex) { 43 - return id(new PhabricatorApplicationTransactionNoEffectResponse()) 44 - ->setCancelURI($view_uri) 45 - ->setException($ex); 46 - } 47 - 48 - if ($draft) { 49 - $draft->replaceOrDelete(); 50 - } 51 - 52 - if ($request->isAjax() && $is_preview) { 53 - return id(new PhabricatorApplicationTransactionResponse()) 54 - ->setViewer($viewer) 55 - ->setTransactions($xactions) 56 - ->setIsPreview($is_preview); 57 - } else { 58 - return id(new AphrontRedirectResponse()) 59 - ->setURI($view_uri); 60 - } 61 - } 62 - 63 - }
+11 -14
src/applications/phurl/controller/PhabricatorPhurlURLViewController.php
··· 30 30 $timeline = $this->buildTransactionTimeline( 31 31 $url, 32 32 new PhabricatorPhurlURLTransactionQuery()); 33 + $timeline->setQuoteRef($url->getMonogram()); 33 34 34 35 $header = $this->buildHeaderView($url); 35 36 $curtain = $this->buildCurtain($url); ··· 39 40 ->setErrors(array(pht('This URL is invalid due to a bad protocol.'))) 40 41 ->setIsHidden($url->isValid()); 41 42 42 - $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); 43 - $add_comment_header = $is_serious 44 - ? pht('Add Comment') 45 - : pht('More Cowbell'); 46 - $draft = PhabricatorDraft::newFromUserAndKey($viewer, $url->getPHID()); 47 - $comment_uri = $this->getApplicationURI( 48 - '/url/comment/'.$url->getID().'/'); 49 - $add_comment_form = id(new PhabricatorApplicationTransactionCommentView()) 50 - ->setUser($viewer) 51 - ->setObjectPHID($url->getPHID()) 52 - ->setDraft($draft) 53 - ->setHeaderText($add_comment_header) 54 - ->setAction($comment_uri) 55 - ->setSubmitButtonName(pht('Add Comment')); 43 + $add_comment_form = $this->buildCommentForm($url, $timeline); 56 44 57 45 $view = id(new PHUITwoColumnView()) 58 46 ->setHeader($header) ··· 72 60 array( 73 61 $view, 74 62 )); 63 + } 75 64 65 + private function buildCommentForm(PhabricatorPhurlURL $url, $timeline) { 66 + $viewer = $this->getViewer(); 67 + $box = id(new PhabricatorPhurlURLEditEngine()) 68 + ->setViewer($viewer) 69 + ->buildEditEngineCommentView($url) 70 + ->setTransactionTimeline($timeline); 71 + 72 + return $box; 76 73 } 77 74 78 75 private function buildHeaderView(PhabricatorPhurlURL $url) {