1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-13 18:32:41 +01:00
phorge-phorge/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php
Bob Trahan 27d44594dc 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
2014-08-07 15:21:32 -07:00

59 lines
1.5 KiB
PHP

<?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);
}
}