Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15401413
D16222.id39023.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D16222.id39023.diff
View Options
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
@@ -127,15 +127,16 @@
$post,
id(new PhamePostTransactionQuery())
->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT)));
- $timeline = phutil_tag_div('phui-document-view-pro-box', $timeline);
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 +274,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);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mar 18 2025, 5:32 PM (5 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7710186
Default Alt Text
D16222.id39023.diff (6 KB)
Attached To
Mode
D16222: Use CommentEditEngine in PhamePost
Attached
Detach File
Event Timeline
Log In to Comment