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 @@ -3831,7 +3831,6 @@ 'PhameNextPostView' => 'applications/phame/view/PhameNextPostView.php', 'PhamePost' => 'applications/phame/storage/PhamePost.php', 'PhamePostArchiveController' => 'applications/phame/controller/post/PhamePostArchiveController.php', - 'PhamePostCommentController' => 'applications/phame/controller/post/PhamePostCommentController.php', 'PhamePostController' => 'applications/phame/controller/post/PhamePostController.php', 'PhamePostEditConduitAPIMethod' => 'applications/phame/conduit/PhamePostEditConduitAPIMethod.php', 'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php', @@ -8755,7 +8754,6 @@ 'PhabricatorFulltextInterface', ), 'PhamePostArchiveController' => 'PhamePostController', - 'PhamePostCommentController' => 'PhamePostController', 'PhamePostController' => 'PhameController', 'PhamePostEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 'PhamePostEditController' => 'PhamePostController', diff --git a/src/applications/phame/application/PhabricatorPhameApplication.php b/src/applications/phame/application/PhabricatorPhameApplication.php --- a/src/applications/phame/application/PhabricatorPhameApplication.php +++ b/src/applications/phame/application/PhabricatorPhameApplication.php @@ -46,17 +46,16 @@ 'post/' => array( '(?:query/(?P[^/]+)/)?' => 'PhamePostListController', 'blogger/(?P[\w\.-_]+)/' => 'PhamePostListController', - 'edit/(?:(?P[^/]+)/)?' => 'PhamePostEditController', + $this->getEditRoutePattern('edit/') + => 'PhamePostEditController', 'history/(?P\d+)/' => 'PhamePostHistoryController', 'view/(?P\d+)/(?:(?P[^/]+)/)?' => 'PhamePostViewController', '(?Ppublish|unpublish)/(?P\d+)/' => 'PhamePostPublishController', 'preview/(?P\d+)/' => 'PhamePostPreviewController', 'preview/' => 'PhabricatorMarkupPreviewController', - 'framed/(?P\d+)/' => 'PhamePostFramedController', 'move/(?P\d+)/' => 'PhamePostMoveController', 'archive/(?P\d+)/' => 'PhamePostArchiveController', - 'comment/(?P[1-9]\d*)/' => 'PhamePostCommentController', ), 'blog/' => array( '(?:query/(?P[^/]+)/)?' => 'PhameBlogListController', diff --git a/src/applications/phame/controller/post/PhamePostCommentController.php b/src/applications/phame/controller/post/PhamePostCommentController.php deleted file mode 100644 --- a/src/applications/phame/controller/post/PhamePostCommentController.php +++ /dev/null @@ -1,63 +0,0 @@ -getViewer(); - $id = $request->getURIData('id'); - - if (!$request->isFormPost()) { - return new Aphront400Response(); - } - - $post = id(new PhamePostQuery()) - ->setViewer($viewer) - ->withIDs(array($id)) - ->executeOne(); - if (!$post) { - return new Aphront404Response(); - } - - $is_preview = $request->isPreviewRequest(); - $draft = PhabricatorDraft::buildFromRequest($request); - - $view_uri = $this->getApplicationURI('post/view/'.$post->getID().'/'); - - $xactions = array(); - $xactions[] = id(new PhamePostTransaction()) - ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) - ->attachComment( - id(new PhamePostTransactionComment()) - ->setContent($request->getStr('comment'))); - - $editor = id(new PhamePostEditor()) - ->setActor($viewer) - ->setContinueOnNoEffect($request->isContinueRequest()) - ->setContentSourceFromRequest($request) - ->setIsPreview($is_preview); - - try { - $xactions = $editor->applyTransactions($post, $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/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php --- a/src/applications/phame/controller/post/PhamePostViewController.php +++ b/src/applications/phame/controller/post/PhamePostViewController.php @@ -123,19 +123,22 @@ ->setImage($blogger->getProfileImageURI()) ->setImageHref($author_uri); + $monogram = $post->getMonogram(); $timeline = $this->buildTransactionTimeline( $post, id(new PhamePostTransactionQuery()) ->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))); - $timeline = phutil_tag_div('phui-document-view-pro-box', $timeline); + $timeline->setQuoteRef($monogram); if ($is_external) { $add_comment = null; } else { - $add_comment = $this->buildCommentForm($post); + $add_comment = $this->buildCommentForm($post, $timeline); $add_comment = phutil_tag_div('mlb mlt', $add_comment); } + $timeline = phutil_tag_div('phui-document-view-pro-box', $timeline); + list($prev, $next) = $this->loadAdjacentPosts($post); $properties = id(new PHUIPropertyListView()) @@ -273,19 +276,13 @@ return $actions; } - private function buildCommentForm(PhamePost $post) { + private function buildCommentForm(PhamePost $post, $timeline) { $viewer = $this->getViewer(); - $draft = PhabricatorDraft::newFromUserAndKey( - $viewer, $post->getPHID()); - - $box = id(new PhabricatorApplicationTransactionCommentView()) - ->setUser($viewer) - ->setObjectPHID($post->getPHID()) - ->setDraft($draft) - ->setHeaderText(pht('Add Comment')) - ->setAction($this->getApplicationURI('post/comment/'.$post->getID().'/')) - ->setSubmitButtonName(pht('Add Comment')); + $box = id(new PhamePostEditEngine()) + ->setViewer($viewer) + ->buildEditEngineCommentView($post) + ->setTransactionTimeline($timeline); return phutil_tag_div('phui-document-view-pro-box', $box); } diff --git a/src/applications/phame/editor/PhamePostEditEngine.php b/src/applications/phame/editor/PhamePostEditEngine.php --- a/src/applications/phame/editor/PhamePostEditEngine.php +++ b/src/applications/phame/editor/PhamePostEditEngine.php @@ -68,6 +68,10 @@ return $object->getViewURI(); } + protected function getEditorURI() { + return $this->getApplication()->getApplicationURI('post/edit/'); + } + protected function buildCustomEditFields($object) { $blog_phid = $object->getBlog()->getPHID(); diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -51,6 +51,10 @@ return $this->assertAttached($this->blog); } + public function getMonogram() { + return 'POST'.$this->getID(); + } + public function getLiveURI() { $blog = $this->getBlog(); $is_draft = $this->isDraft();