1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 12:30:56 +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 {
private $action;
private $branchID;
public function willProcessRequest(array $data) {
$this->action = $data['action'];
$this->branchID = $data['branchID'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$action = $request->getURIData('action');
$id = $request->getURIData('branchID');
$branch = id(new ReleephBranchQuery())
->setViewer($viewer)
->withIDs(array($this->branchID))
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
@ -28,7 +21,6 @@ final class ReleephBranchAccessController extends ReleephBranchController {
}
$this->setBranch($branch);
$action = $this->action;
switch ($action) {
case 'close':
case 're-open':

View file

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

View file

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

View file

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

View file

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

View file

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