Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14036341
D17823.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
D17823.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
@@ -2975,7 +2975,6 @@
'PhabricatorMacroAudioBehaviorTransaction' => 'applications/macro/xaction/PhabricatorMacroAudioBehaviorTransaction.php',
'PhabricatorMacroAudioController' => 'applications/macro/controller/PhabricatorMacroAudioController.php',
'PhabricatorMacroAudioTransaction' => 'applications/macro/xaction/PhabricatorMacroAudioTransaction.php',
- 'PhabricatorMacroCommentController' => 'applications/macro/controller/PhabricatorMacroCommentController.php',
'PhabricatorMacroConfigOptions' => 'applications/macro/config/PhabricatorMacroConfigOptions.php',
'PhabricatorMacroController' => 'applications/macro/controller/PhabricatorMacroController.php',
'PhabricatorMacroDatasource' => 'applications/macro/typeahead/PhabricatorMacroDatasource.php',
@@ -8190,7 +8189,6 @@
'PhabricatorMacroAudioBehaviorTransaction' => 'PhabricatorMacroTransactionType',
'PhabricatorMacroAudioController' => 'PhabricatorMacroController',
'PhabricatorMacroAudioTransaction' => 'PhabricatorMacroTransactionType',
- 'PhabricatorMacroCommentController' => 'PhabricatorMacroController',
'PhabricatorMacroConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorMacroController' => 'PhabricatorController',
'PhabricatorMacroDatasource' => 'PhabricatorTypeaheadDatasource',
diff --git a/src/applications/macro/application/PhabricatorMacroApplication.php b/src/applications/macro/application/PhabricatorMacroApplication.php
--- a/src/applications/macro/application/PhabricatorMacroApplication.php
+++ b/src/applications/macro/application/PhabricatorMacroApplication.php
@@ -32,7 +32,6 @@
'(query/(?P<key>[^/]+)/)?' => 'PhabricatorMacroListController',
'create/' => 'PhabricatorMacroEditController',
'view/(?P<id>[1-9]\d*)/' => 'PhabricatorMacroViewController',
- 'comment/(?P<id>[1-9]\d*)/' => 'PhabricatorMacroCommentController',
$this->getEditRoutePattern('edit/')
=> 'PhabricatorMacroEditController',
'audio/(?P<id>[1-9]\d*)/' => 'PhabricatorMacroAudioController',
diff --git a/src/applications/macro/controller/PhabricatorMacroCommentController.php b/src/applications/macro/controller/PhabricatorMacroCommentController.php
deleted file mode 100644
--- a/src/applications/macro/controller/PhabricatorMacroCommentController.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-final class PhabricatorMacroCommentController
- extends PhabricatorMacroController {
-
- public function handleRequest(AphrontRequest $request) {
- $viewer = $request->getViewer();
- $id = $request->getURIData('id');
-
- if (!$request->isFormPost()) {
- return new Aphront400Response();
- }
-
- $macro = id(new PhabricatorMacroQuery())
- ->setViewer($viewer)
- ->withIDs(array($id))
- ->executeOne();
- if (!$macro) {
- return new Aphront404Response();
- }
-
- $is_preview = $request->isPreviewRequest();
- $draft = PhabricatorDraft::buildFromRequest($request);
-
- $view_uri = $this->getApplicationURI('/view/'.$macro->getID().'/');
-
- $xactions = array();
- $xactions[] = id(new PhabricatorMacroTransaction())
- ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
- ->attachComment(
- id(new PhabricatorMacroTransactionComment())
- ->setContent($request->getStr('comment')));
-
- $editor = id(new PhabricatorMacroEditor())
- ->setActor($viewer)
- ->setContinueOnNoEffect($request->isContinueRequest())
- ->setContentSourceFromRequest($request)
- ->setIsPreview($is_preview);
-
- try {
- $xactions = $editor->applyTransactions($macro, $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/macro/controller/PhabricatorMacroViewController.php b/src/applications/macro/controller/PhabricatorMacroViewController.php
--- a/src/applications/macro/controller/PhabricatorMacroViewController.php
+++ b/src/applications/macro/controller/PhabricatorMacroViewController.php
@@ -36,6 +36,8 @@
$macro,
new PhabricatorMacroTransactionQuery());
+ $comment_form = $this->buildCommentForm($macro, $timeline);
+
$header = id(new PHUIHeaderView())
->setUser($viewer)
->setPolicyObject($macro)
@@ -48,29 +50,13 @@
$header->setStatus('fa-ban', 'indigo', pht('Archived'));
}
- $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
-
- $comment_header = $is_serious
- ? pht('Add Comment')
- : pht('Grovel in Awe');
-
- $draft = PhabricatorDraft::newFromUserAndKey($viewer, $macro->getPHID());
-
- $add_comment_form = id(new PhabricatorApplicationTransactionCommentView())
- ->setUser($viewer)
- ->setObjectPHID($macro->getPHID())
- ->setDraft($draft)
- ->setHeaderText($comment_header)
- ->setAction($this->getApplicationURI('/comment/'.$macro->getID().'/'))
- ->setSubmitButtonName(pht('Add Comment'));
-
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setSubheader($subheader)
->setCurtain($curtain)
->setMainColumn(array(
$timeline,
- $add_comment_form,
+ $comment_form,
))
->addPropertySection(pht('Macro'), $file)
->addPropertySection(pht('Details'), $details);
@@ -82,6 +68,16 @@
->appendChild($view);
}
+ private function buildCommentForm(
+ PhabricatorFileImageMacro $macro, $timeline) {
+ $viewer = $this->getViewer();
+
+ return id(new PhabricatorMacroEditEngine())
+ ->setViewer($viewer)
+ ->buildEditEngineCommentView($macro)
+ ->setTransactionTimeline($timeline);
+ }
+
private function buildCurtain(
PhabricatorFileImageMacro $macro) {
$can_manage = $this->hasApplicationCapability(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 11, 9:47 AM (1 d, 17 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6735721
Default Alt Text
D17823.diff (6 KB)
Attached To
Mode
D17823: Update Macro comment form
Attached
Detach File
Event Timeline
Log In to Comment