mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-18 02:31:10 +01:00
Transactions - add "view raw" action
Summary: Use cutlery icon for hilarity. Ref T5768. Test Plan: made something with remarkup in it, used 'view raw' and saw the remarkup raw in a nice little dialogue. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5768 Differential Revision: https://secure.phabricator.com/D10183
This commit is contained in:
parent
7388351aab
commit
27d44594dc
6 changed files with 86 additions and 12 deletions
|
@ -8,7 +8,7 @@
|
||||||
return array(
|
return array(
|
||||||
'names' => array(
|
'names' => array(
|
||||||
'core.pkg.css' => '519e8478',
|
'core.pkg.css' => '519e8478',
|
||||||
'core.pkg.js' => '4c28870b',
|
'core.pkg.js' => 'eb8d4f82',
|
||||||
'darkconsole.pkg.js' => 'df001cab',
|
'darkconsole.pkg.js' => 'df001cab',
|
||||||
'differential.pkg.css' => '4a93db37',
|
'differential.pkg.css' => '4a93db37',
|
||||||
'differential.pkg.js' => 'eb182ccd',
|
'differential.pkg.js' => 'eb182ccd',
|
||||||
|
@ -425,7 +425,7 @@ return array(
|
||||||
'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08',
|
'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08',
|
||||||
'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => 'd6f54db0',
|
'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => 'd6f54db0',
|
||||||
'rsrc/js/application/transactions/behavior-transaction-comment-form.js' => '9f7309fb',
|
'rsrc/js/application/transactions/behavior-transaction-comment-form.js' => '9f7309fb',
|
||||||
'rsrc/js/application/transactions/behavior-transaction-list.js' => '71f66c08',
|
'rsrc/js/application/transactions/behavior-transaction-list.js' => '13c739ea',
|
||||||
'rsrc/js/application/uiexample/JavelinViewExample.js' => 'd4a14807',
|
'rsrc/js/application/uiexample/JavelinViewExample.js' => 'd4a14807',
|
||||||
'rsrc/js/application/uiexample/ReactorButtonExample.js' => 'd19198c8',
|
'rsrc/js/application/uiexample/ReactorButtonExample.js' => 'd19198c8',
|
||||||
'rsrc/js/application/uiexample/ReactorCheckboxExample.js' => '519705ea',
|
'rsrc/js/application/uiexample/ReactorCheckboxExample.js' => '519705ea',
|
||||||
|
@ -629,7 +629,7 @@ return array(
|
||||||
'javelin-behavior-phabricator-show-all-transactions' => '7c273581',
|
'javelin-behavior-phabricator-show-all-transactions' => '7c273581',
|
||||||
'javelin-behavior-phabricator-tooltips' => '3ee3408b',
|
'javelin-behavior-phabricator-tooltips' => '3ee3408b',
|
||||||
'javelin-behavior-phabricator-transaction-comment-form' => '9f7309fb',
|
'javelin-behavior-phabricator-transaction-comment-form' => '9f7309fb',
|
||||||
'javelin-behavior-phabricator-transaction-list' => '71f66c08',
|
'javelin-behavior-phabricator-transaction-list' => '13c739ea',
|
||||||
'javelin-behavior-phabricator-watch-anchor' => '06e05112',
|
'javelin-behavior-phabricator-watch-anchor' => '06e05112',
|
||||||
'javelin-behavior-phame-post-preview' => 'be807912',
|
'javelin-behavior-phame-post-preview' => 'be807912',
|
||||||
'javelin-behavior-pholio-mock-edit' => '9c2623f4',
|
'javelin-behavior-pholio-mock-edit' => '9c2623f4',
|
||||||
|
@ -925,6 +925,14 @@ return array(
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
'phabricator-shaped-request',
|
'phabricator-shaped-request',
|
||||||
),
|
),
|
||||||
|
'13c739ea' => array(
|
||||||
|
'javelin-behavior',
|
||||||
|
'javelin-stratcom',
|
||||||
|
'javelin-workflow',
|
||||||
|
'javelin-dom',
|
||||||
|
'javelin-uri',
|
||||||
|
'phabricator-textareautils',
|
||||||
|
),
|
||||||
'14a827de' => array(
|
'14a827de' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-stratcom',
|
'javelin-stratcom',
|
||||||
|
@ -1280,14 +1288,6 @@ return array(
|
||||||
'phabricator-phtize',
|
'phabricator-phtize',
|
||||||
'changeset-view-manager',
|
'changeset-view-manager',
|
||||||
),
|
),
|
||||||
'71f66c08' => array(
|
|
||||||
'javelin-behavior',
|
|
||||||
'javelin-stratcom',
|
|
||||||
'javelin-workflow',
|
|
||||||
'javelin-dom',
|
|
||||||
'javelin-uri',
|
|
||||||
'phabricator-textareautils',
|
|
||||||
),
|
|
||||||
'7319e029' => array(
|
'7319e029' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
|
|
|
@ -1109,6 +1109,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorApplicationTransactionCommentHistoryController' => 'applications/transactions/controller/PhabricatorApplicationTransactionCommentHistoryController.php',
|
'PhabricatorApplicationTransactionCommentHistoryController' => 'applications/transactions/controller/PhabricatorApplicationTransactionCommentHistoryController.php',
|
||||||
'PhabricatorApplicationTransactionCommentQuery' => 'applications/transactions/query/PhabricatorApplicationTransactionCommentQuery.php',
|
'PhabricatorApplicationTransactionCommentQuery' => 'applications/transactions/query/PhabricatorApplicationTransactionCommentQuery.php',
|
||||||
'PhabricatorApplicationTransactionCommentQuoteController' => 'applications/transactions/controller/PhabricatorApplicationTransactionCommentQuoteController.php',
|
'PhabricatorApplicationTransactionCommentQuoteController' => 'applications/transactions/controller/PhabricatorApplicationTransactionCommentQuoteController.php',
|
||||||
|
'PhabricatorApplicationTransactionCommentRawController' => 'applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php',
|
||||||
'PhabricatorApplicationTransactionCommentRemoveController' => 'applications/transactions/controller/PhabricatorApplicationTransactionCommentRemoveController.php',
|
'PhabricatorApplicationTransactionCommentRemoveController' => 'applications/transactions/controller/PhabricatorApplicationTransactionCommentRemoveController.php',
|
||||||
'PhabricatorApplicationTransactionCommentView' => 'applications/transactions/view/PhabricatorApplicationTransactionCommentView.php',
|
'PhabricatorApplicationTransactionCommentView' => 'applications/transactions/view/PhabricatorApplicationTransactionCommentView.php',
|
||||||
'PhabricatorApplicationTransactionController' => 'applications/transactions/controller/PhabricatorApplicationTransactionController.php',
|
'PhabricatorApplicationTransactionController' => 'applications/transactions/controller/PhabricatorApplicationTransactionController.php',
|
||||||
|
@ -3912,6 +3913,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorApplicationTransactionCommentHistoryController' => 'PhabricatorApplicationTransactionController',
|
'PhabricatorApplicationTransactionCommentHistoryController' => 'PhabricatorApplicationTransactionController',
|
||||||
'PhabricatorApplicationTransactionCommentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorApplicationTransactionCommentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorApplicationTransactionCommentQuoteController' => 'PhabricatorApplicationTransactionController',
|
'PhabricatorApplicationTransactionCommentQuoteController' => 'PhabricatorApplicationTransactionController',
|
||||||
|
'PhabricatorApplicationTransactionCommentRawController' => 'PhabricatorApplicationTransactionController',
|
||||||
'PhabricatorApplicationTransactionCommentRemoveController' => 'PhabricatorApplicationTransactionController',
|
'PhabricatorApplicationTransactionCommentRemoveController' => 'PhabricatorApplicationTransactionController',
|
||||||
'PhabricatorApplicationTransactionCommentView' => 'AphrontView',
|
'PhabricatorApplicationTransactionCommentView' => 'AphrontView',
|
||||||
'PhabricatorApplicationTransactionController' => 'PhabricatorController',
|
'PhabricatorApplicationTransactionController' => 'PhabricatorController',
|
||||||
|
|
|
@ -25,6 +25,8 @@ final class PhabricatorTransactionsApplication extends PhabricatorApplication {
|
||||||
=> 'PhabricatorApplicationTransactionCommentHistoryController',
|
=> 'PhabricatorApplicationTransactionCommentHistoryController',
|
||||||
'quote/(?<phid>[^/]+)/'
|
'quote/(?<phid>[^/]+)/'
|
||||||
=> 'PhabricatorApplicationTransactionCommentQuoteController',
|
=> 'PhabricatorApplicationTransactionCommentQuoteController',
|
||||||
|
'raw/(?<phid>[^/]+)/'
|
||||||
|
=> 'PhabricatorApplicationTransactionCommentRawController',
|
||||||
'detail/(?<phid>[^/]+)/'
|
'detail/(?<phid>[^/]+)/'
|
||||||
=> 'PhabricatorApplicationTransactionDetailController',
|
=> 'PhabricatorApplicationTransactionDetailController',
|
||||||
'(?P<value>old|new)/(?<phid>[^/]+)/'
|
'(?P<value>old|new)/(?<phid>[^/]+)/'
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorApplicationTransactionCommentRawController
|
||||||
|
extends PhabricatorApplicationTransactionController {
|
||||||
|
|
||||||
|
private $phid;
|
||||||
|
|
||||||
|
public function willProcessRequest(array $data) {
|
||||||
|
$this->phid = $data['phid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processRequest() {
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$user = $request->getUser();
|
||||||
|
|
||||||
|
$xaction = id(new PhabricatorObjectQuery())
|
||||||
|
->withPHIDs(array($this->phid))
|
||||||
|
->setViewer($user)
|
||||||
|
->executeOne();
|
||||||
|
|
||||||
|
if (!$xaction) {
|
||||||
|
return new Aphront404Response();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$xaction->getComment()) {
|
||||||
|
// You can't view a raw comment if there is no comment.
|
||||||
|
return new Aphront404Response();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($xaction->getComment()->getIsRemoved()) {
|
||||||
|
// You can't view a raw comment if the comment is deleted.
|
||||||
|
return new Aphront400Response();
|
||||||
|
}
|
||||||
|
|
||||||
|
$obj_phid = $xaction->getObjectPHID();
|
||||||
|
$obj_handle = id(new PhabricatorHandleQuery())
|
||||||
|
->setViewer($user)
|
||||||
|
->withPHIDs(array($obj_phid))
|
||||||
|
->executeOne();
|
||||||
|
|
||||||
|
$dialog = id(new AphrontDialogView())
|
||||||
|
->setUser($user)
|
||||||
|
->addCancelButton($obj_handle->getURI())
|
||||||
|
->setTitle(pht('Raw Comment'));
|
||||||
|
|
||||||
|
$dialog
|
||||||
|
->addHiddenInput('anchor', $request->getStr('anchor'))
|
||||||
|
->appendChild(
|
||||||
|
id(new PHUIFormLayoutView())
|
||||||
|
->setFullWidth(true)
|
||||||
|
->appendChild(
|
||||||
|
id(new AphrontFormTextAreaControl())
|
||||||
|
->setReadOnly(true)
|
||||||
|
->setValue($xaction->getComment()->getContent())));
|
||||||
|
|
||||||
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -528,6 +528,17 @@ final class PHUITimelineEventView extends AphrontView {
|
||||||
'uri' => '/transactions/quote/'.$xaction_phid.'/',
|
'uri' => '/transactions/quote/'.$xaction_phid.'/',
|
||||||
'ref' => $ref,
|
'ref' => $ref,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// if there is something to quote then there is something to view raw
|
||||||
|
$items[] = id(new PhabricatorActionView())
|
||||||
|
->setIcon('fa-cutlery')
|
||||||
|
->setHref('/transactions/raw/'.$xaction_phid.'/')
|
||||||
|
->setName(pht('View Raw'))
|
||||||
|
->addSigil('transaction-raw')
|
||||||
|
->setMetadata(
|
||||||
|
array(
|
||||||
|
'anchor' => $anchor,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->getIsRemovable()) {
|
if ($this->getIsRemovable()) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ JX.behavior('phabricator-transaction-list', function() {
|
||||||
|
|
||||||
JX.Stratcom.listen(
|
JX.Stratcom.listen(
|
||||||
'click',
|
'click',
|
||||||
[['transaction-edit'], ['transaction-remove']],
|
[['transaction-edit'], ['transaction-remove'], ['transaction-raw']],
|
||||||
function(e) {
|
function(e) {
|
||||||
if (!e.isNormalClick()) {
|
if (!e.isNormalClick()) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue