Differential D14001 Diff 33843 src/applications/releeph/controller/product/ReleephProductActionController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/releeph/controller/product/ReleephProductActionController.php
<?php | <?php | ||||
final class ReleephProductActionController extends ReleephProductController { | final class ReleephProductActionController extends ReleephProductController { | ||||
private $id; | public function handleRequest(AphrontRequest $request) { | ||||
private $action; | $viewer = $request->getViewer(); | ||||
$id = $request->getURIData('projectID'); | |||||
public function willProcessRequest(array $data) { | $action = $request->getURIData('action'); | ||||
$this->id = $data['projectID']; | |||||
$this->action = $data['action']; | |||||
} | |||||
public function processRequest() { | |||||
$request = $this->getRequest(); | |||||
$viewer = $request->getUser(); | |||||
$product = id(new ReleephProductQuery()) | $product = id(new ReleephProductQuery()) | ||||
->withIDs(array($this->id)) | ->withIDs(array($id)) | ||||
->requireCapabilities( | ->requireCapabilities( | ||||
array( | array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
)) | )) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$product) { | if (!$product) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
$this->setProduct($product); | $this->setProduct($product); | ||||
$product_id = $product->getID(); | $product_id = $product->getID(); | ||||
$product_uri = $this->getProductViewURI($product); | $product_uri = $this->getProductViewURI($product); | ||||
$action = $this->action; | |||||
switch ($action) { | switch ($action) { | ||||
case 'deactivate': | case 'deactivate': | ||||
case 'activate': | case 'activate': | ||||
break; | break; | ||||
default: | default: | ||||
throw new Aphront404Response(); | throw new Aphront404Response(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |