Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15386957
D8957.id21250.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
13 KB
Referenced Files
None
Subscribers
None
D8957.id21250.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -414,7 +414,7 @@
'rsrc/js/application/search/behavior-reorder-queries.js' => '37871df4',
'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => 'a51fdb2e',
'rsrc/js/application/transactions/behavior-transaction-comment-form.js' => '9084a36f',
- 'rsrc/js/application/transactions/behavior-transaction-list.js' => '3f812373',
+ 'rsrc/js/application/transactions/behavior-transaction-list.js' => 'b8e6b76f',
'rsrc/js/application/uiexample/JavelinViewExample.js' => 'd4a14807',
'rsrc/js/application/uiexample/ReactorButtonExample.js' => '44524435',
'rsrc/js/application/uiexample/ReactorCheckboxExample.js' => '7ba325ee',
@@ -609,7 +609,7 @@
'javelin-behavior-phabricator-show-all-transactions' => '7c273581',
'javelin-behavior-phabricator-tooltips' => '48db4145',
'javelin-behavior-phabricator-transaction-comment-form' => '9084a36f',
- 'javelin-behavior-phabricator-transaction-list' => '3f812373',
+ 'javelin-behavior-phabricator-transaction-list' => 'b8e6b76f',
'javelin-behavior-phabricator-watch-anchor' => '06e05112',
'javelin-behavior-phame-post-preview' => '61d927ec',
'javelin-behavior-pholio-mock-edit' => '1e1e8bb0',
@@ -1075,15 +1075,6 @@
1 => 'javelin-dom',
2 => 'phortune-credit-card-form',
),
- '3f812373' =>
- array(
- 0 => 'javelin-behavior',
- 1 => 'javelin-stratcom',
- 2 => 'javelin-workflow',
- 3 => 'javelin-dom',
- 4 => 'javelin-fx',
- 5 => 'javelin-util',
- ),
'4398eabb' =>
array(
0 => 'javelin-behavior',
@@ -1217,13 +1208,6 @@
2 => 'javelin-util',
3 => 'phabricator-shaped-request',
),
- '62e18640' =>
- array(
- 0 => 'javelin-install',
- 1 => 'javelin-util',
- 2 => 'javelin-dom',
- 3 => 'javelin-typeahead-normalizer',
- ),
'6453c869' =>
array(
0 => 'javelin-install',
@@ -1257,6 +1241,13 @@
0 => 'javelin-behavior',
1 => 'javelin-dom',
),
+ '62e18640' =>
+ array(
+ 0 => 'javelin-install',
+ 1 => 'javelin-util',
+ 2 => 'javelin-dom',
+ 3 => 'javelin-typeahead-normalizer',
+ ),
'75903ee1' =>
array(
0 => 'javelin-behavior',
@@ -1582,6 +1573,16 @@
4 => 'javelin-install',
5 => 'javelin-util',
),
+ 'b8e6b76f' =>
+ array(
+ 0 => 'javelin-behavior',
+ 1 => 'javelin-stratcom',
+ 2 => 'javelin-workflow',
+ 3 => 'javelin-dom',
+ 4 => 'javelin-fx',
+ 5 => 'javelin-util',
+ 6 => 'phabricator-textareautils',
+ ),
'b98fc918' =>
array(
0 => 'javelin-behavior',
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
@@ -1162,6 +1162,7 @@
'PhabricatorApplicationTransactionCommentEditor' => 'applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php',
'PhabricatorApplicationTransactionCommentHistoryController' => 'applications/transactions/controller/PhabricatorApplicationTransactionCommentHistoryController.php',
'PhabricatorApplicationTransactionCommentQuery' => 'applications/transactions/query/PhabricatorApplicationTransactionCommentQuery.php',
+ 'PhabricatorApplicationTransactionCommentQuoteController' => 'applications/transactions/controller/PhabricatorApplicationTransactionCommentQuoteController.php',
'PhabricatorApplicationTransactionCommentRemoveController' => 'applications/transactions/controller/PhabricatorApplicationTransactionCommentRemoveController.php',
'PhabricatorApplicationTransactionCommentView' => 'applications/transactions/view/PhabricatorApplicationTransactionCommentView.php',
'PhabricatorApplicationTransactionController' => 'applications/transactions/controller/PhabricatorApplicationTransactionController.php',
@@ -3932,6 +3933,7 @@
'PhabricatorApplicationTransactionCommentEditor' => 'PhabricatorEditor',
'PhabricatorApplicationTransactionCommentHistoryController' => 'PhabricatorApplicationTransactionController',
'PhabricatorApplicationTransactionCommentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
+ 'PhabricatorApplicationTransactionCommentQuoteController' => 'PhabricatorApplicationTransactionController',
'PhabricatorApplicationTransactionCommentRemoveController' => 'PhabricatorApplicationTransactionController',
'PhabricatorApplicationTransactionCommentView' => 'AphrontView',
'PhabricatorApplicationTransactionController' => 'PhabricatorController',
diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php
--- a/src/applications/differential/controller/DifferentialRevisionViewController.php
+++ b/src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -256,6 +256,11 @@
$target,
$all_changesets);
+ if (!$viewer_is_anonymous) {
+ $comment_view->setQuoteRef('D'.$revision->getID());
+ $comment_view->setQuoteTargetID('comment-content');
+ }
+
$wrap_id = celerity_generate_unique_node_id();
$comment_view = phutil_tag(
'div',
@@ -373,8 +378,6 @@
$comment_form->setErrorView($review_warnings_panel);
}
- // TODO: Restore the ability for fields to add accept warnings.
-
$comment_form->setActions($this->getRevisionCommentActions($revision));
$action_uri = $this->getApplicationURI(
'comment/save/'.$revision->getID().'/');
@@ -415,6 +418,7 @@
$changeset_view,
));
if ($comment_form) {
+
$page_pane->appendChild($comment_form);
} else {
// TODO: For now, just use this to get "Login to Comment".
diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
--- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -377,6 +377,8 @@
->setFlush(true)
->setHeaderText($comment_header)
->appendChild($comment_form);
+ $timeline->setQuoteTargetID('transaction-comments');
+ $timeline->setQuoteRef($object_name);
}
$object_box = id(new PHUIObjectBoxView())
diff --git a/src/applications/transactions/application/PhabricatorApplicationTransactions.php b/src/applications/transactions/application/PhabricatorApplicationTransactions.php
--- a/src/applications/transactions/application/PhabricatorApplicationTransactions.php
+++ b/src/applications/transactions/application/PhabricatorApplicationTransactions.php
@@ -19,6 +19,8 @@
=> 'PhabricatorApplicationTransactionCommentRemoveController',
'history/(?<phid>[^/]+)/'
=> 'PhabricatorApplicationTransactionCommentHistoryController',
+ 'quote/(?<phid>[^/]+)/'
+ => 'PhabricatorApplicationTransactionCommentQuoteController',
'detail/(?<phid>[^/]+)/'
=> 'PhabricatorApplicationTransactionDetailController',
'(?P<value>old|new)/(?<phid>[^/]+)/'
diff --git a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentQuoteController.php b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentQuoteController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentQuoteController.php
@@ -0,0 +1,67 @@
+<?php
+
+final class PhabricatorApplicationTransactionCommentQuoteController
+ extends PhabricatorApplicationTransactionController {
+
+ private $phid;
+
+ public function willProcessRequest(array $data) {
+ $this->phid = $data['phid'];
+ }
+
+ public function processRequest() {
+ $request = $this->getRequest();
+ $viewer = $request->getUser();
+
+ $xaction = id(new PhabricatorObjectQuery())
+ ->withPHIDs(array($this->phid))
+ ->setViewer($viewer)
+ ->executeOne();
+ if (!$xaction) {
+ return new Aphront404Response();
+ }
+
+ if (!$xaction->getComment()) {
+ return new Aphront404Response();
+ }
+
+ if ($xaction->getComment()->getIsRemoved()) {
+ return new Aphront400Response();
+ }
+
+ if (!$xaction->hasComment()) {
+ return new Aphront404Response();
+ }
+
+ $content = $xaction->getComment()->getContent();
+ $content = phutil_split_lines($content, true);
+ foreach ($content as $key => $line) {
+ if (strlen($line) && ($line[0] != '>')) {
+ $content[$key] = '> '.$line;
+ } else {
+ $content[$key] = '>'.$line;
+ }
+ }
+ $content = implode('', $content);
+
+ $author = id(new PhabricatorHandleQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($xaction->getComment()->getAuthorPHID()))
+ ->executeOne();
+
+ $ref = $request->getStr('ref');
+ if (strlen($ref)) {
+ $quote = pht('In %s, %s wrote:', $ref, '@'.$author->getName());
+ } else {
+ $quote = pht('%s wrote:', '@'.$author->getName());
+ }
+
+ $content = ">>! {$quote}\n{$content}";
+
+ return id(new AphrontAjaxResponse())->setContent(
+ array(
+ 'quoteText' => $content,
+ ));
+ }
+
+}
diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
--- a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
+++ b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
@@ -12,6 +12,26 @@
private $isPreview;
private $objectPHID;
private $shouldTerminate = false;
+ private $quoteTargetID;
+ private $quoteRef;
+
+ public function setQuoteRef($quote_ref) {
+ $this->quoteRef = $quote_ref;
+ return $this;
+ }
+
+ public function getQuoteRef() {
+ return $this->quoteRef;
+ }
+
+ public function setQuoteTargetID($quote_target_id) {
+ $this->quoteTargetID = $quote_target_id;
+ return $this;
+ }
+
+ public function getQuoteTargetID() {
+ return $this->quoteTargetID;
+ }
public function setObjectPHID($object_phid) {
$this->objectPHID = $object_phid;
@@ -376,6 +396,17 @@
$event->setIsEdited(true);
}
+ // If we have a place for quoted text to go and this is a quotable
+ // comment, pass the quote target ID to the event view.
+ if ($this->getQuoteTargetID()) {
+ if ($xaction->hasComment()) {
+ if (!$has_removed_comment && !$has_deleted_comment) {
+ $event->setQuoteTargetID($this->getQuoteTargetID());
+ $event->setQuoteRef($this->getQuoteRef());
+ }
+ }
+ }
+
$can_edit = PhabricatorPolicyCapability::CAN_EDIT;
if ($xaction->hasComment() || $has_deleted_comment) {
diff --git a/src/view/phui/PHUITimelineEventView.php b/src/view/phui/PHUITimelineEventView.php
--- a/src/view/phui/PHUITimelineEventView.php
+++ b/src/view/phui/PHUITimelineEventView.php
@@ -21,6 +21,26 @@
private $hideByDefault;
private $token;
private $tokenRemoved;
+ private $quoteTargetID;
+ private $quoteRef;
+
+ public function setQuoteRef($quote_ref) {
+ $this->quoteRef = $quote_ref;
+ return $this;
+ }
+
+ public function getQuoteRef() {
+ return $this->quoteRef;
+ }
+
+ public function setQuoteTargetID($quote_target_id) {
+ $this->quoteTargetID = $quote_target_id;
+ return $this;
+ }
+
+ public function getQuoteTargetID() {
+ return $this->quoteTargetID;
+ }
public function setHideByDefault($hide_by_default) {
$this->hideByDefault = $hide_by_default;
@@ -350,6 +370,31 @@
} else {
$xaction_phid = $this->getTransactionPHID();
+ if ($this->getQuoteTargetID()) {
+
+ $ref = null;
+ if ($this->getQuoteRef()) {
+ $ref = $this->getQuoteRef();
+ if ($this->anchor) {
+ $ref = $ref.'#'.$this->anchor;
+ }
+ }
+
+ $extra[] = javelin_tag(
+ 'a',
+ array(
+ 'href' => '#',
+ 'sigil' => 'transaction-quote',
+ 'mustcapture' => true,
+ 'meta' => array(
+ 'targetID' => $this->getQuoteTargetID(),
+ 'uri' => '/transactions/quote/'.$xaction_phid.'/',
+ 'ref' => $ref,
+ ),
+ ),
+ pht('Quote'));
+ }
+
if ($this->getIsEdited()) {
$extra[] = javelin_tag(
'a',
diff --git a/webroot/rsrc/js/application/transactions/behavior-transaction-list.js b/webroot/rsrc/js/application/transactions/behavior-transaction-list.js
--- a/webroot/rsrc/js/application/transactions/behavior-transaction-list.js
+++ b/webroot/rsrc/js/application/transactions/behavior-transaction-list.js
@@ -6,6 +6,7 @@
* javelin-dom
* javelin-fx
* javelin-util
+ * phabricator-textareautils
*/
JX.behavior('phabricator-transaction-list', function(config) {
@@ -115,6 +116,37 @@
e.kill();
});
+ JX.DOM.listen(
+ list,
+ 'click',
+ 'transaction-quote',
+ function(e) {
+ e.kill();
+
+ var data = e.getNodeData('transaction-quote');
+ new JX.Workflow(data.uri)
+ .setData({ref: data.ref})
+ .setHandler(function(r) {
+ var textarea = JX.$(data.targetID);
+
+ JX.DOM.scrollTo(textarea);
+
+ var value = textarea.value;
+ if (value.length) {
+ value += "\n\n";
+ }
+ value += r.quoteText;
+ value += "\n\n";
+ textarea.value = value;
+
+ JX.TextAreaUtils.setSelectionRange(
+ textarea,
+ textarea.value.length,
+ textarea.value.length);
+ })
+ .start();
+ });
+
JX.Stratcom.listen(
['submit', 'didSyntheticSubmit'],
'transaction-append',
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 1:34 AM (3 w, 12 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704974
Default Alt Text
D8957.id21250.diff (13 KB)
Attached To
Mode
D8957: Add a quote action to Differential and Maniphest
Attached
Detach File
Event Timeline
Log In to Comment