diff --git a/src/applications/phlux/controller/PhluxEditController.php b/src/applications/phlux/controller/PhluxEditController.php --- a/src/applications/phlux/controller/PhluxEditController.php +++ b/src/applications/phlux/controller/PhluxEditController.php @@ -2,35 +2,29 @@ final class PhluxEditController extends PhluxController { - private $key; + public function handleRequest(AphrontRequest $request) { + $viewer = $this->getViewer(); + $key = $request->getURIData('key'); - public function willProcessRequest(array $data) { - $this->key = idx($data, 'key'); - } - - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); - - $is_new = ($this->key === null); + $is_new = ($key === null); if ($is_new) { $var = new PhluxVariable(); $var->setViewPolicy(PhabricatorPolicies::POLICY_USER); $var->setEditPolicy(PhabricatorPolicies::POLICY_USER); } else { $var = id(new PhluxVariableQuery()) - ->setViewer($user) + ->setViewer($viewer) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT, )) - ->withKeys(array($this->key)) + ->withKeys(array($key)) ->executeOne(); if (!$var) { return new Aphront404Response(); } - $view_uri = $this->getApplicationURI('/view/'.$this->key.'/'); + $view_uri = $this->getApplicationURI('/view/'.$key.'/'); } $e_key = ($is_new ? true : null); @@ -67,7 +61,7 @@ if (!$errors) { $editor = id(new PhluxVariableEditor()) - ->setActor($user) + ->setActor($viewer) ->setContinueOnNoEffect(true) ->setContentSourceFromRequest($request); @@ -110,12 +104,12 @@ } $policies = id(new PhabricatorPolicyQuery()) - ->setViewer($user) + ->setViewer($viewer) ->setObject($var) ->execute(); $form = id(new AphrontFormView()) - ->setUser($user) + ->setUser($viewer) ->appendChild( id(new AphrontFormTextControl()) ->setValue($var->getVariableKey()) @@ -161,7 +155,7 @@ $title = pht('Create Variable'); $crumbs->addTextCrumb($title, $request->getRequestURI()); } else { - $title = pht('Edit %s', $this->key); + $title = pht('Edit %s', $key); $crumbs->addTextCrumb($title, $request->getRequestURI()); } diff --git a/src/applications/phlux/controller/PhluxListController.php b/src/applications/phlux/controller/PhluxListController.php --- a/src/applications/phlux/controller/PhluxListController.php +++ b/src/applications/phlux/controller/PhluxListController.php @@ -2,14 +2,13 @@ final class PhluxListController extends PhluxController { - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $this->getViewer(); $pager = new AphrontCursorPagerView(); $pager->readFromRequest($request); $query = id(new PhluxVariableQuery()) - ->setViewer($user); + ->setViewer($viewer); $vars = $query->executeWithCursorPager($pager); @@ -22,7 +21,7 @@ $item->setHref($this->getApplicationURI('/view/'.$key.'/')); $item->addIcon( 'none', - phabricator_datetime($var->getDateModified(), $user)); + phabricator_datetime($var->getDateModified(), $viewer)); $view->addItem($item); } diff --git a/src/applications/phlux/controller/PhluxViewController.php b/src/applications/phlux/controller/PhluxViewController.php --- a/src/applications/phlux/controller/PhluxViewController.php +++ b/src/applications/phlux/controller/PhluxViewController.php @@ -2,19 +2,13 @@ final class PhluxViewController extends PhluxController { - private $key; - - public function willProcessRequest(array $data) { - $this->key = $data['key']; - } - - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $this->getViewer(); + $key = $request->getURIData('key'); $var = id(new PhluxVariableQuery()) - ->setViewer($user) - ->withKeys(array($this->key)) + ->setViewer($viewer) + ->withKeys(array($key)) ->executeOne(); if (!$var) { @@ -29,16 +23,16 @@ $header = id(new PHUIHeaderView()) ->setHeader($title) - ->setUser($user) + ->setUser($viewer) ->setPolicyObject($var); $actions = id(new PhabricatorActionListView()) - ->setUser($user) + ->setUser($viewer) ->setObjectURI($request->getRequestURI()) ->setObject($var); $can_edit = PhabricatorPolicyFilter::hasCapability( - $user, + $viewer, $var, PhabricatorPolicyCapability::CAN_EDIT); @@ -53,7 +47,7 @@ $display_value = json_encode($var->getVariableValue()); $properties = id(new PHUIPropertyListView()) - ->setUser($user) + ->setUser($viewer) ->setObject($var) ->setActionList($actions) ->addProperty(pht('Value'), $display_value);