Page MenuHomePhabricator

D13678.id.diff
No OneTemporary

D13678.id.diff

diff --git a/src/applications/tokens/controller/PhabricatorTokenGiveController.php b/src/applications/tokens/controller/PhabricatorTokenGiveController.php
--- a/src/applications/tokens/controller/PhabricatorTokenGiveController.php
+++ b/src/applications/tokens/controller/PhabricatorTokenGiveController.php
@@ -2,27 +2,21 @@
final class PhabricatorTokenGiveController extends PhabricatorTokenController {
- private $phid;
-
- public function willProcessRequest(array $data) {
- $this->phid = $data['phid'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+ $phid = $request->getURIData('phid');
$handle = id(new PhabricatorHandleQuery())
- ->setViewer($user)
- ->withPHIDs(array($this->phid))
+ ->setViewer($viewer)
+ ->withPHIDs(array($phid))
->executeOne();
if (!$handle->isComplete()) {
return new Aphront404Response();
}
$current = id(new PhabricatorTokenGivenQuery())
- ->setViewer($user)
- ->withAuthorPHIDs(array($user->getPHID()))
+ ->setViewer($viewer)
+ ->withAuthorPHIDs(array($viewer->getPHID()))
->withObjectPHIDs(array($handle->getPHID()))
->execute();
@@ -39,7 +33,7 @@
$content_source = PhabricatorContentSource::newFromRequest($request);
$editor = id(new PhabricatorTokenGivenEditor())
- ->setActor($user)
+ ->setActor($viewer)
->setContentSource($content_source);
if ($is_give) {
$token_phid = $request->getStr('tokenPHID');
@@ -57,17 +51,17 @@
$dialog = $this->buildRescindTokenDialog(head($current));
}
- $dialog->setUser($user);
+ $dialog->setUser($viewer);
$dialog->addCancelButton($done_uri);
return id(new AphrontDialogResponse())->setDialog($dialog);
}
private function buildGiveTokenDialog() {
- $user = $this->getRequest()->getUser();
+ $viewer = $this->getViewer();
$tokens = id(new PhabricatorTokenQuery())
- ->setViewer($user)
+ ->setViewer($viewer)
->execute();
$buttons = array();
diff --git a/src/applications/tokens/controller/PhabricatorTokenGivenController.php b/src/applications/tokens/controller/PhabricatorTokenGivenController.php
--- a/src/applications/tokens/controller/PhabricatorTokenGivenController.php
+++ b/src/applications/tokens/controller/PhabricatorTokenGivenController.php
@@ -6,24 +6,23 @@
return true;
}
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
$pager = id(new AphrontCursorPagerView())
->readFromRequest($request);
$tokens_given = id(new PhabricatorTokenGivenQuery())
- ->setViewer($user)
+ ->setViewer($viewer)
->executeWithCursorPager($pager);
$handles = array();
if ($tokens_given) {
$object_phids = mpull($tokens_given, 'getObjectPHID');
- $user_phids = mpull($tokens_given, 'getAuthorPHID');
- $handle_phids = array_merge($object_phids, $user_phids);
+ $viewer_phids = mpull($tokens_given, 'getAuthorPHID');
+ $handle_phids = array_merge($object_phids, $viewer_phids);
$handles = id(new PhabricatorHandleQuery())
- ->setViewer($user)
+ ->setViewer($viewer)
->withPHIDs($handle_phids)
->execute();
}
@@ -32,7 +31,7 @@
if ($tokens_given) {
$token_phids = mpull($tokens_given, 'getTokenPHID');
$tokens = id(new PhabricatorTokenQuery())
- ->setViewer($user)
+ ->setViewer($viewer)
->withPHIDs($token_phids)
->execute();
$tokens = mpull($tokens, null, 'getPHID');
@@ -53,7 +52,7 @@
pht(
'Given by %s on %s',
$handles[$token_given->getAuthorPHID()]->renderLink(),
- phabricator_date($token_given->getDateCreated(), $user)));
+ phabricator_date($token_given->getDateCreated(), $viewer)));
$list->addItem($item);
}
diff --git a/src/applications/tokens/controller/PhabricatorTokenLeaderController.php b/src/applications/tokens/controller/PhabricatorTokenLeaderController.php
--- a/src/applications/tokens/controller/PhabricatorTokenLeaderController.php
+++ b/src/applications/tokens/controller/PhabricatorTokenLeaderController.php
@@ -7,16 +7,15 @@
return true;
}
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
$pager = new PHUIPagerView();
$pager->setURI($request->getRequestURI(), 'page');
$pager->setOffset($request->getInt('page'));
$query = id(new PhabricatorTokenReceiverQuery());
- $objects = $query->setViewer($user)->executeWithOffsetPager($pager);
+ $objects = $query->setViewer($viewer)->executeWithOffsetPager($pager);
$counts = $query->getTokenCounts();
$handles = array();
@@ -24,7 +23,7 @@
if ($counts) {
$phids = mpull($objects, 'getPHID');
$handles = id(new PhabricatorHandleQuery())
- ->setViewer($user)
+ ->setViewer($viewer)
->withPHIDs($phids)
->execute();
}

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 28, 9:17 PM (6 d, 13 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7384976
Default Alt Text
D13678.id.diff (5 KB)

Event Timeline