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

Update Releeph Branch for handleProcess

Summary: Updates Releeph Branch controllers

Test Plan: bounce around releeph, arc lint

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13721
This commit is contained in:
Chad Little 2015-07-27 07:42:29 -07:00
parent cb1f4ea721
commit 2d35d6053a
6 changed files with 25 additions and 60 deletions

View file

@ -2,21 +2,14 @@
final class ReleephBranchAccessController extends ReleephBranchController { final class ReleephBranchAccessController extends ReleephBranchController {
private $action; public function handleRequest(AphrontRequest $request) {
private $branchID; $viewer = $request->getViewer();
$action = $request->getURIData('action');
public function willProcessRequest(array $data) { $id = $request->getURIData('branchID');
$this->action = $data['action'];
$this->branchID = $data['branchID'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$branch = id(new ReleephBranchQuery()) $branch = id(new ReleephBranchQuery())
->setViewer($viewer) ->setViewer($viewer)
->withIDs(array($this->branchID)) ->withIDs(array($id))
->requireCapabilities( ->requireCapabilities(
array( array(
PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_VIEW,
@ -28,7 +21,6 @@ final class ReleephBranchAccessController extends ReleephBranchController {
} }
$this->setBranch($branch); $this->setBranch($branch);
$action = $this->action;
switch ($action) { switch ($action) {
case 'close': case 'close':
case 're-open': case 're-open':

View file

@ -2,19 +2,13 @@
final class ReleephBranchCreateController extends ReleephProductController { final class ReleephBranchCreateController extends ReleephProductController {
private $productID; public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
public function willProcessRequest(array $data) { $id = $request->getURIData('projectID');
$this->productID = $data['projectID'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$product = id(new ReleephProductQuery()) $product = id(new ReleephProductQuery())
->setViewer($viewer) ->setViewer($viewer)
->withIDs(array($this->productID)) ->withIDs(array($id))
->requireCapabilities( ->requireCapabilities(
array( array(
PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_VIEW,

View file

@ -2,15 +2,9 @@
final class ReleephBranchEditController extends ReleephBranchController { final class ReleephBranchEditController extends ReleephBranchController {
private $branchID; public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
public function willProcessRequest(array $data) { $id = $request->getURIData('branchID');
$this->branchID = $data['branchID'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$branch = id(new ReleephBranchQuery()) $branch = id(new ReleephBranchQuery())
->setViewer($viewer) ->setViewer($viewer)
@ -19,7 +13,7 @@ final class ReleephBranchEditController extends ReleephBranchController {
PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT, PhabricatorPolicyCapability::CAN_EDIT,
)) ))
->withIDs(array($this->branchID)) ->withIDs(array($id))
->executeOne(); ->executeOne();
if (!$branch) { if (!$branch) {
return new Aphront404Response(); return new Aphront404Response();
@ -40,8 +34,7 @@ final class ReleephBranchEditController extends ReleephBranchController {
$symbolic_name); $symbolic_name);
$branch->openTransaction(); $branch->openTransaction();
$branch $branch->setSymbolicName($symbolic_name);
->setSymbolicName($symbolic_name);
if ($existing_with_same_symbolic_name) { if ($existing_with_same_symbolic_name) {
$existing_with_same_symbolic_name $existing_with_same_symbolic_name

View file

@ -2,23 +2,17 @@
final class ReleephBranchHistoryController extends ReleephBranchController { final class ReleephBranchHistoryController extends ReleephBranchController {
private $branchID;
public function shouldAllowPublic() { public function shouldAllowPublic() {
return true; return true;
} }
public function willProcessRequest(array $data) { public function handleRequest(AphrontRequest $request) {
$this->branchID = $data['branchID']; $viewer = $request->getViewer();
} $id = $request->getURIData('branchID');
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$branch = id(new ReleephBranchQuery()) $branch = id(new ReleephBranchQuery())
->setViewer($viewer) ->setViewer($viewer)
->withIDs(array($this->branchID)) ->withIDs(array($id))
->executeOne(); ->executeOne();
if (!$branch) { if (!$branch) {
return new Aphront404Response(); return new Aphront404Response();

View file

@ -3,8 +3,7 @@
final class ReleephBranchNamePreviewController final class ReleephBranchNamePreviewController
extends ReleephController { extends ReleephController {
public function processRequest() { public function handleRequest(AphrontRequest $request) {
$request = $this->getRequest();
$is_symbolic = $request->getBool('isSymbolic'); $is_symbolic = $request->getBool('isSymbolic');
$template = $request->getStr('template'); $template = $request->getStr('template');

View file

@ -2,25 +2,18 @@
final class ReleephBranchViewController extends ReleephBranchController { final class ReleephBranchViewController extends ReleephBranchController {
private $queryKey;
private $branchID;
public function shouldAllowPublic() { public function shouldAllowPublic() {
return true; return true;
} }
public function willProcessRequest(array $data) { public function handleRequest(AphrontRequest $request) {
$this->branchID = $data['branchID']; $viewer = $request->getViewer();
$this->queryKey = idx($data, 'queryKey'); $id = $request->getURIData('branchID');
} $querykey = $request->getURIData('queryKey');
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$branch = id(new ReleephBranchQuery()) $branch = id(new ReleephBranchQuery())
->setViewer($viewer) ->setViewer($viewer)
->withIDs(array($this->branchID)) ->withIDs(array($id))
->executeOne(); ->executeOne();
if (!$branch) { if (!$branch) {
return new Aphront404Response(); return new Aphront404Response();
@ -29,7 +22,7 @@ final class ReleephBranchViewController extends ReleephBranchController {
$controller = id(new PhabricatorApplicationSearchController()) $controller = id(new PhabricatorApplicationSearchController())
->setPreface($this->renderPreface()) ->setPreface($this->renderPreface())
->setQueryKey($this->queryKey) ->setQueryKey($querykey)
->setSearchEngine($this->getSearchEngine()) ->setSearchEngine($this->getSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());