Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15283237
D14267.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D14267.diff
View Options
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);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 5, 6:20 AM (4 d, 14 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223736
Default Alt Text
D14267.diff (5 KB)
Attached To
Mode
D14267: Update Phlux for handleRequest
Attached
Detach File
Event Timeline
Log In to Comment