mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Update Releeph for handleRequest
Summary: Updates Releeph callsites to handleRequest Test Plan: Bounce around Releeph, cut a branch, edit a product, view history Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D14001
This commit is contained in:
parent
a339e6de9e
commit
4c77ff68aa
12 changed files with 54 additions and 122 deletions
|
@ -2,20 +2,13 @@
|
|||
|
||||
final class ReleephProductActionController extends ReleephProductController {
|
||||
|
||||
private $id;
|
||||
private $action;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['projectID'];
|
||||
$this->action = $data['action'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('projectID');
|
||||
$action = $request->getURIData('action');
|
||||
|
||||
$product = id(new ReleephProductQuery())
|
||||
->withIDs(array($this->id))
|
||||
->withIDs(array($id))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
|
@ -32,7 +25,6 @@ final class ReleephProductActionController extends ReleephProductController {
|
|||
$product_id = $product->getID();
|
||||
$product_uri = $this->getProductViewURI($product);
|
||||
|
||||
$action = $this->action;
|
||||
switch ($action) {
|
||||
case 'deactivate':
|
||||
case 'activate':
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
final class ReleephProductCreateController extends ReleephProductController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$name = trim($request->getStr('name'));
|
||||
$trunk_branch = trim($request->getStr('trunkBranch'));
|
||||
$repository_phid = $request->getStr('repositoryPHID');
|
||||
|
|
|
@ -2,19 +2,13 @@
|
|||
|
||||
final class ReleephProductEditController 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,
|
||||
|
|
|
@ -2,23 +2,17 @@
|
|||
|
||||
final class ReleephProductHistoryController extends ReleephProductController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function shouldAllowPublic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $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->id))
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
if (!$product) {
|
||||
return new Aphront404Response();
|
||||
|
@ -32,6 +26,7 @@ final class ReleephProductHistoryController extends ReleephProductController {
|
|||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb(pht('History'));
|
||||
$crumbs->setBorder(true);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
|
|
|
@ -2,19 +2,14 @@
|
|||
|
||||
final class ReleephProductListController extends ReleephController {
|
||||
|
||||
private $queryKey;
|
||||
|
||||
public function shouldAllowPublic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->queryKey = idx($data, 'queryKey');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$query_key = $request->getURIData('queryKey');
|
||||
$controller = id(new PhabricatorApplicationSearchController())
|
||||
->setQueryKey($this->queryKey)
|
||||
->setQueryKey($query_key)
|
||||
->setSearchEngine(new ReleephProductSearchEngine())
|
||||
->setNavigation($this->buildSideNavView());
|
||||
|
||||
|
|
|
@ -2,25 +2,18 @@
|
|||
|
||||
final class ReleephProductViewController extends ReleephProductController {
|
||||
|
||||
private $productID;
|
||||
private $queryKey;
|
||||
|
||||
public function shouldAllowPublic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->productID = idx($data, 'projectID');
|
||||
$this->queryKey = idx($data, 'queryKey');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$id = $request->getURIData('projectID');
|
||||
$query_key = $request->getURIData('queryKey');
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
$product = id(new ReleephProductQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->productID))
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
if (!$product) {
|
||||
return new Aphront404Response();
|
||||
|
@ -28,7 +21,7 @@ final class ReleephProductViewController extends ReleephProductController {
|
|||
$this->setProduct($product);
|
||||
|
||||
$controller = id(new PhabricatorApplicationSearchController())
|
||||
->setQueryKey($this->queryKey)
|
||||
->setQueryKey($query_key)
|
||||
->setPreface($this->renderPreface())
|
||||
->setSearchEngine(
|
||||
id(new ReleephBranchSearchEngine())
|
||||
|
|
|
@ -3,23 +3,16 @@
|
|||
final class ReleephRequestActionController
|
||||
extends ReleephRequestController {
|
||||
|
||||
private $action;
|
||||
private $requestID;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->action = $data['action'];
|
||||
$this->requestID = $data['requestID'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$action = $request->getURIData('action');
|
||||
$id = $request->getURIData('requestID');
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
$request->validateCSRF();
|
||||
|
||||
$pull = id(new ReleephRequestQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->requestID))
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
if (!$pull) {
|
||||
return new Aphront404Response();
|
||||
|
@ -27,9 +20,6 @@ final class ReleephRequestActionController
|
|||
|
||||
$branch = $pull->getBranch();
|
||||
$product = $branch->getProduct();
|
||||
|
||||
$action = $this->action;
|
||||
|
||||
$origin_uri = '/'.$pull->getMonogram();
|
||||
|
||||
$editor = id(new ReleephRequestTransactionalEditor())
|
||||
|
|
|
@ -3,15 +3,9 @@
|
|||
final class ReleephRequestCommentController
|
||||
extends ReleephRequestController {
|
||||
|
||||
private $requestID;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->requestID = $data['requestID'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$id = $request->getURIData('requestID');
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
if (!$request->isFormPost()) {
|
||||
return new Aphront400Response();
|
||||
|
@ -19,7 +13,7 @@ final class ReleephRequestCommentController
|
|||
|
||||
$pull = id(new ReleephRequestQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->requestID))
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
if (!$pull) {
|
||||
return new Aphront404Response();
|
||||
|
|
|
@ -5,20 +5,15 @@
|
|||
final class ReleephRequestDifferentialCreateController
|
||||
extends ReleephController {
|
||||
|
||||
private $revisionID;
|
||||
private $revision;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->revisionID = $data['diffRevID'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$revision_id = $request->getURIData('diffRevID');
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
$diff_rev = id(new DifferentialRevisionQuery())
|
||||
->setViewer($user)
|
||||
->withIDs(array($this->revisionID))
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($revision_id))
|
||||
->executeOne();
|
||||
if (!$diff_rev) {
|
||||
return new Aphront404Response();
|
||||
|
@ -63,7 +58,7 @@ final class ReleephRequestDifferentialCreateController
|
|||
|
||||
require_celerity_resource('releeph-request-differential-create-dialog');
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($user)
|
||||
->setUser($viewer)
|
||||
->setTitle(pht('Choose Releeph Branch'))
|
||||
->setClass('releeph-request-differential-create-dialog')
|
||||
->addCancelButton('/D'.$request->getStr('D'));
|
||||
|
|
|
@ -2,22 +2,16 @@
|
|||
|
||||
final class ReleephRequestEditController extends ReleephBranchController {
|
||||
|
||||
private $requestID;
|
||||
private $branchID;
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$action = $request->getURIData('action');
|
||||
$request_id = $request->getURIData('requestID');
|
||||
$branch_id = $request->getURIData('branchID');
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->requestID = idx($data, 'requestID');
|
||||
$this->branchID = idx($data, 'branchID');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
|
||||
if ($this->requestID) {
|
||||
if ($request_id) {
|
||||
$pull = id(new ReleephRequestQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->requestID))
|
||||
->withIDs(array($request_id))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
|
@ -34,7 +28,7 @@ final class ReleephRequestEditController extends ReleephBranchController {
|
|||
} else {
|
||||
$branch = id(new ReleephBranchQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->branchID))
|
||||
->withIDs(array($branch_id))
|
||||
->executeOne();
|
||||
if (!$branch) {
|
||||
return new Aphront404Response();
|
||||
|
@ -77,8 +71,8 @@ final class ReleephRequestEditController extends ReleephBranchController {
|
|||
$field_list->readFieldsFromStorage($pull);
|
||||
|
||||
|
||||
if ($this->branchID) {
|
||||
$cancel_uri = $this->getApplicationURI('branch/'.$this->branchID.'/');
|
||||
if ($branch_id) {
|
||||
$cancel_uri = $this->getApplicationURI('branch/'.$branch_id.'/');
|
||||
} else {
|
||||
$cancel_uri = '/'.$pull->getMonogram();
|
||||
}
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
final class ReleephRequestTypeaheadController
|
||||
extends PhabricatorTypeaheadDatasourceController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$query = $request->getStr('q');
|
||||
$repo_id = $request->getInt('repo');
|
||||
$since = $request->getInt('since');
|
||||
|
|
|
@ -3,19 +3,13 @@
|
|||
final class ReleephRequestViewController
|
||||
extends ReleephBranchController {
|
||||
|
||||
private $requestID;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->requestID = $data['requestID'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$id = $request->getURIData('requestID');
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
$pull = id(new ReleephRequestQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->requestID))
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
if (!$pull) {
|
||||
return new Aphront404Response();
|
||||
|
@ -92,7 +86,6 @@ final class ReleephRequestViewController
|
|||
),
|
||||
array(
|
||||
'title' => $title,
|
||||
'device' => true,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue