diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3445,7 +3445,6 @@ 'PhabricatorPhurlURL' => 'applications/phurl/storage/PhabricatorPhurlURL.php', 'PhabricatorPhurlURLAccessController' => 'applications/phurl/controller/PhabricatorPhurlURLAccessController.php', 'PhabricatorPhurlURLAliasTransaction' => 'applications/phurl/xaction/PhabricatorPhurlURLAliasTransaction.php', - 'PhabricatorPhurlURLCommentController' => 'applications/phurl/controller/PhabricatorPhurlURLCommentController.php', 'PhabricatorPhurlURLCreateCapability' => 'applications/phurl/capability/PhabricatorPhurlURLCreateCapability.php', 'PhabricatorPhurlURLDatasource' => 'applications/phurl/typeahead/PhabricatorPhurlURLDatasource.php', 'PhabricatorPhurlURLDescriptionTransaction' => 'applications/phurl/xaction/PhabricatorPhurlURLDescriptionTransaction.php', @@ -8711,7 +8710,6 @@ ), 'PhabricatorPhurlURLAccessController' => 'PhabricatorPhurlController', 'PhabricatorPhurlURLAliasTransaction' => 'PhabricatorPhurlURLTransactionType', - 'PhabricatorPhurlURLCommentController' => 'PhabricatorPhurlController', 'PhabricatorPhurlURLCreateCapability' => 'PhabricatorPolicyCapability', 'PhabricatorPhurlURLDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorPhurlURLDescriptionTransaction' => 'PhabricatorPhurlURLTransactionType', diff --git a/src/applications/phurl/application/PhabricatorPhurlApplication.php b/src/applications/phurl/application/PhabricatorPhurlApplication.php --- a/src/applications/phurl/application/PhabricatorPhurlApplication.php +++ b/src/applications/phurl/application/PhabricatorPhurlApplication.php @@ -48,8 +48,6 @@ 'url/' => array( $this->getEditRoutePattern('edit/') => 'PhabricatorPhurlURLEditController', - 'comment/(?P[1-9]\d*)/' - => 'PhabricatorPhurlURLCommentController', ), ), ); diff --git a/src/applications/phurl/controller/PhabricatorPhurlURLCommentController.php b/src/applications/phurl/controller/PhabricatorPhurlURLCommentController.php deleted file mode 100644 --- a/src/applications/phurl/controller/PhabricatorPhurlURLCommentController.php +++ /dev/null @@ -1,63 +0,0 @@ -isFormPost()) { - return new Aphront400Response(); - } - - $viewer = $request->getViewer(); - $id = $request->getURIData('id'); - - $is_preview = $request->isPreviewRequest(); - $draft = PhabricatorDraft::buildFromRequest($request); - - $phurl = id(new PhabricatorPhurlURLQuery()) - ->setViewer($viewer) - ->withIDs(array($id)) - ->executeOne(); - if (!$phurl) { - return new Aphront404Response(); - } - - $view_uri = '/'.$phurl->getMonogram(); - - $xactions = array(); - $xactions[] = id(new PhabricatorPhurlURLTransaction()) - ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) - ->attachComment( - id(new PhabricatorPhurlURLTransactionComment()) - ->setContent($request->getStr('comment'))); - - $editor = id(new PhabricatorPhurlURLEditor()) - ->setActor($viewer) - ->setContinueOnNoEffect($request->isContinueRequest()) - ->setContentSourceFromRequest($request) - ->setIsPreview($is_preview); - - try { - $xactions = $editor->applyTransactions($phurl, $xactions); - } catch (PhabricatorApplicationTransactionNoEffectException $ex) { - return id(new PhabricatorApplicationTransactionNoEffectResponse()) - ->setCancelURI($view_uri) - ->setException($ex); - } - - if ($draft) { - $draft->replaceOrDelete(); - } - - if ($request->isAjax() && $is_preview) { - return id(new PhabricatorApplicationTransactionResponse()) - ->setViewer($viewer) - ->setTransactions($xactions) - ->setIsPreview($is_preview); - } else { - return id(new AphrontRedirectResponse()) - ->setURI($view_uri); - } - } - -} diff --git a/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php b/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php --- a/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php +++ b/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php @@ -30,6 +30,7 @@ $timeline = $this->buildTransactionTimeline( $url, new PhabricatorPhurlURLTransactionQuery()); + $timeline->setQuoteRef($url->getMonogram()); $header = $this->buildHeaderView($url); $curtain = $this->buildCurtain($url); @@ -39,20 +40,7 @@ ->setErrors(array(pht('This URL is invalid due to a bad protocol.'))) ->setIsHidden($url->isValid()); - $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); - $add_comment_header = $is_serious - ? pht('Add Comment') - : pht('More Cowbell'); - $draft = PhabricatorDraft::newFromUserAndKey($viewer, $url->getPHID()); - $comment_uri = $this->getApplicationURI( - '/url/comment/'.$url->getID().'/'); - $add_comment_form = id(new PhabricatorApplicationTransactionCommentView()) - ->setUser($viewer) - ->setObjectPHID($url->getPHID()) - ->setDraft($draft) - ->setHeaderText($add_comment_header) - ->setAction($comment_uri) - ->setSubmitButtonName(pht('Add Comment')); + $add_comment_form = $this->buildCommentForm($url, $timeline); $view = id(new PHUITwoColumnView()) ->setHeader($header) @@ -72,7 +60,16 @@ array( $view, )); + } + + private function buildCommentForm(PhabricatorPhurlURL $url, $timeline) { + $viewer = $this->getViewer(); + $box = id(new PhabricatorPhurlURLEditEngine()) + ->setViewer($viewer) + ->buildEditEngineCommentView($url) + ->setTransactionTimeline($timeline); + return $box; } private function buildHeaderView(PhabricatorPhurlURL $url) {