Page MenuHomePhabricator

D16222.id39024.diff
No OneTemporary

D16222.id39024.diff

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<queryKey>[^/]+)/)?' => 'PhamePostListController',
'blogger/(?P<bloggername>[\w\.-_]+)/' => 'PhamePostListController',
- 'edit/(?:(?P<id>[^/]+)/)?' => 'PhamePostEditController',
+ $this->getEditRoutePattern('edit/')
+ => 'PhamePostEditController',
'history/(?P<id>\d+)/' => 'PhamePostHistoryController',
'view/(?P<id>\d+)/(?:(?P<slug>[^/]+)/)?' => 'PhamePostViewController',
'(?P<action>publish|unpublish)/(?P<id>\d+)/'
=> 'PhamePostPublishController',
'preview/(?P<id>\d+)/' => 'PhamePostPreviewController',
'preview/' => 'PhabricatorMarkupPreviewController',
- 'framed/(?P<id>\d+)/' => 'PhamePostFramedController',
'move/(?P<id>\d+)/' => 'PhamePostMoveController',
'archive/(?P<id>\d+)/' => 'PhamePostArchiveController',
- 'comment/(?P<id>[1-9]\d*)/' => 'PhamePostCommentController',
),
'blog/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' => '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 @@
-<?php
-
-final class PhamePostCommentController
- extends PhamePostController {
-
- public function handleRequest(AphrontRequest $request) {
- $viewer = $request->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();

File Metadata

Mime Type
text/plain
Expires
Sat, May 11, 9:42 PM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6286832
Default Alt Text
D16222.id39024.diff (7 KB)

Event Timeline