1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Update transactions for handleRequest

Summary: Updates Transactions for handleRequest

Test Plan: Leave Comment, View Raw, Delete, Quote, etc.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T8628

Differential Revision: https://secure.phabricator.com/D14629
This commit is contained in:
Chad Little 2015-12-01 19:46:57 -08:00
parent 1b61af126f
commit b5bd4c65c2
6 changed files with 27 additions and 54 deletions

View file

@ -3,23 +3,17 @@
final class PhabricatorApplicationTransactionCommentHistoryController final class PhabricatorApplicationTransactionCommentHistoryController
extends PhabricatorApplicationTransactionController { extends PhabricatorApplicationTransactionController {
private $phid;
public function shouldAllowPublic() { public function shouldAllowPublic() {
return true; return true;
} }
public function willProcessRequest(array $data) { public function handleRequest(AphrontRequest $request) {
$this->phid = $data['phid']; $viewer = $this->getViewer();
} $phid = $request->getURIData('phid');
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$xaction = id(new PhabricatorObjectQuery()) $xaction = id(new PhabricatorObjectQuery())
->withPHIDs(array($this->phid)) ->withPHIDs(array($phid))
->setViewer($user) ->setViewer($viewer)
->executeOne(); ->executeOne();
if (!$xaction) { if (!$xaction) {
@ -37,7 +31,7 @@ final class PhabricatorApplicationTransactionCommentHistoryController
} }
$comments = id(new PhabricatorApplicationTransactionTemplatedCommentQuery()) $comments = id(new PhabricatorApplicationTransactionTemplatedCommentQuery())
->setViewer($user) ->setViewer($viewer)
->setTemplate($xaction->getApplicationTransactionCommentObject()) ->setTemplate($xaction->getApplicationTransactionCommentObject())
->withTransactionPHIDs(array($xaction->getPHID())) ->withTransactionPHIDs(array($xaction->getPHID()))
->execute(); ->execute();
@ -60,19 +54,19 @@ final class PhabricatorApplicationTransactionCommentHistoryController
$obj_phid = $xaction->getObjectPHID(); $obj_phid = $xaction->getObjectPHID();
$obj_handle = id(new PhabricatorHandleQuery()) $obj_handle = id(new PhabricatorHandleQuery())
->setViewer($user) ->setViewer($viewer)
->withPHIDs(array($obj_phid)) ->withPHIDs(array($obj_phid))
->executeOne(); ->executeOne();
$view = id(new PhabricatorApplicationTransactionView()) $view = id(new PhabricatorApplicationTransactionView())
->setUser($user) ->setUser($viewer)
->setObjectPHID($obj_phid) ->setObjectPHID($obj_phid)
->setTransactions($xactions) ->setTransactions($xactions)
->setShowEditActions(false) ->setShowEditActions(false)
->setHideCommentOptions(true); ->setHideCommentOptions(true);
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($viewer)
->setWidth(AphrontDialogView::WIDTH_FULL) ->setWidth(AphrontDialogView::WIDTH_FULL)
->setFlush(true) ->setFlush(true)
->setTitle(pht('Comment History')); ->setTitle(pht('Comment History'));

View file

@ -3,18 +3,12 @@
final class PhabricatorApplicationTransactionCommentQuoteController final class PhabricatorApplicationTransactionCommentQuoteController
extends PhabricatorApplicationTransactionController { extends PhabricatorApplicationTransactionController {
private $phid; public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
public function willProcessRequest(array $data) { $phid = $request->getURIData('phid');
$this->phid = $data['phid'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$xaction = id(new PhabricatorObjectQuery()) $xaction = id(new PhabricatorObjectQuery())
->withPHIDs(array($this->phid)) ->withPHIDs(array($phid))
->setViewer($viewer) ->setViewer($viewer)
->executeOne(); ->executeOne();
if (!$xaction) { if (!$xaction) {

View file

@ -3,19 +3,13 @@
final class PhabricatorApplicationTransactionCommentRawController final class PhabricatorApplicationTransactionCommentRawController
extends PhabricatorApplicationTransactionController { extends PhabricatorApplicationTransactionController {
private $phid; public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
public function willProcessRequest(array $data) { $phid = $request->getURIData('phid');
$this->phid = $data['phid'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$xaction = id(new PhabricatorObjectQuery()) $xaction = id(new PhabricatorObjectQuery())
->withPHIDs(array($this->phid)) ->withPHIDs(array($phid))
->setViewer($user) ->setViewer($viewer)
->executeOne(); ->executeOne();
if (!$xaction) { if (!$xaction) {
@ -34,7 +28,7 @@ final class PhabricatorApplicationTransactionCommentRawController
$obj_phid = $xaction->getObjectPHID(); $obj_phid = $xaction->getObjectPHID();
$obj_handle = id(new PhabricatorHandleQuery()) $obj_handle = id(new PhabricatorHandleQuery())
->setViewer($user) ->setViewer($viewer)
->withPHIDs(array($obj_phid)) ->withPHIDs(array($obj_phid))
->executeOne(); ->executeOne();
@ -59,13 +53,13 @@ final class PhabricatorApplicationTransactionCommentRawController
$addendum = PhabricatorMarkupEngine::renderOneObject( $addendum = PhabricatorMarkupEngine::renderOneObject(
id(new PhabricatorMarkupOneOff())->setContent($details_text), id(new PhabricatorMarkupOneOff())->setContent($details_text),
'default', 'default',
$user); $viewer);
} }
} }
} }
} }
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($viewer)
->addCancelButton($obj_handle->getURI()) ->addCancelButton($obj_handle->getURI())
->setTitle($title); ->setTitle($title);

View file

@ -3,18 +3,12 @@
final class PhabricatorApplicationTransactionCommentRemoveController final class PhabricatorApplicationTransactionCommentRemoveController
extends PhabricatorApplicationTransactionController { extends PhabricatorApplicationTransactionController {
private $phid; public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
public function willProcessRequest(array $data) { $phid = $request->getURIData('phid');
$this->phid = $data['phid'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$xaction = id(new PhabricatorObjectQuery()) $xaction = id(new PhabricatorObjectQuery())
->withPHIDs(array($this->phid)) ->withPHIDs(array($phid))
->setViewer($viewer) ->setViewer($viewer)
->executeOne(); ->executeOne();
if (!$xaction) { if (!$xaction) {

View file

@ -8,8 +8,7 @@ final class PhabricatorApplicationTransactionShowOlderController
} }
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$request = $this->getRequest(); $viewer = $this->getViewer();
$viewer = $request->getUser();
$object = id(new PhabricatorObjectQuery()) $object = id(new PhabricatorObjectQuery())
->withPHIDs(array($request->getURIData('phid'))) ->withPHIDs(array($request->getURIData('phid')))

View file

@ -8,9 +8,7 @@ final class PhabricatorApplicationTransactionValueController
} }
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$request = $this->getRequest(); $viewer = $this->getViewer();
$viewer = $request->getUser();
$phid = $request->getURIData('phid'); $phid = $request->getURIData('phid');
$type = $request->getURIData('value'); $type = $request->getURIData('value');