mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
Update Fund for handleProcess
Summary: Updates the Fund application Test Plan: New Initiative, Back, Close, View Backers Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D13758
This commit is contained in:
parent
b24935df2f
commit
a66be3fa28
6 changed files with 31 additions and 64 deletions
|
@ -3,26 +3,21 @@
|
||||||
final class FundBackerListController
|
final class FundBackerListController
|
||||||
extends FundController {
|
extends FundController {
|
||||||
|
|
||||||
private $id;
|
|
||||||
private $queryKey;
|
|
||||||
private $initiative;
|
private $initiative;
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$this->id = idx($data, 'id');
|
$viewer = $request->getViewer();
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
$id = $request->getURIData('id');
|
||||||
}
|
$querykey = $request->getURIData('queryKey');
|
||||||
|
|
||||||
public function processRequest() {
|
if ($id) {
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
if ($this->id) {
|
|
||||||
$this->initiative = id(new FundInitiativeQuery())
|
$this->initiative = id(new FundInitiativeQuery())
|
||||||
->setViewer($request->getUser())
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$this->initiative) {
|
if (!$this->initiative) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
@ -30,7 +25,7 @@ final class FundBackerListController
|
||||||
}
|
}
|
||||||
|
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
$controller = id(new PhabricatorApplicationSearchController())
|
||||||
->setQueryKey($this->queryKey)
|
->setQueryKey($querykey)
|
||||||
->setSearchEngine($this->getEngine())
|
->setSearchEngine($this->getEngine())
|
||||||
->setNavigation($this->buildSideNavView());
|
->setNavigation($this->buildSideNavView());
|
||||||
|
|
||||||
|
@ -66,8 +61,7 @@ final class FundBackerListController
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getEngine() {
|
private function getEngine() {
|
||||||
$request = $this->getRequest();
|
$viewer = $this->getViewer();
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$engine = id(new FundBackerSearchEngine())
|
$engine = id(new FundBackerSearchEngine())
|
||||||
->setViewer($viewer);
|
->setViewer($viewer);
|
||||||
|
|
|
@ -3,19 +3,13 @@
|
||||||
final class FundInitiativeBackController
|
final class FundInitiativeBackController
|
||||||
extends FundController {
|
extends FundController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$initiative = id(new FundInitiativeQuery())
|
$initiative = id(new FundInitiativeQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$initiative) {
|
if (!$initiative) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
|
|
@ -3,19 +3,13 @@
|
||||||
final class FundInitiativeCloseController
|
final class FundInitiativeCloseController
|
||||||
extends FundController {
|
extends FundController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$initiative = id(new FundInitiativeQuery())
|
$initiative = id(new FundInitiativeQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
PhabricatorPolicyCapability::CAN_VIEW,
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
|
|
@ -3,20 +3,14 @@
|
||||||
final class FundInitiativeEditController
|
final class FundInitiativeEditController
|
||||||
extends FundController {
|
extends FundController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
|
$id = $request->getURIData('id');
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
if ($id) {
|
||||||
$this->id = idx($data, 'id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
if ($this->id) {
|
|
||||||
$initiative = id(new FundInitiativeQuery())
|
$initiative = id(new FundInitiativeQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
PhabricatorPolicyCapability::CAN_VIEW,
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
|
|
@ -3,19 +3,15 @@
|
||||||
final class FundInitiativeListController
|
final class FundInitiativeListController
|
||||||
extends FundController {
|
extends FundController {
|
||||||
|
|
||||||
private $queryKey;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
$querykey = $request->getURIData('queryKey');
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
$controller = id(new PhabricatorApplicationSearchController())
|
||||||
->setQueryKey($this->queryKey)
|
->setQueryKey($querykey)
|
||||||
->setSearchEngine(new FundInitiativeSearchEngine())
|
->setSearchEngine(new FundInitiativeSearchEngine())
|
||||||
->setNavigation($this->buildSideNavView());
|
->setNavigation($this->buildSideNavView());
|
||||||
|
|
||||||
|
@ -23,13 +19,13 @@ final class FundInitiativeListController
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildSideNavView() {
|
public function buildSideNavView() {
|
||||||
$user = $this->getRequest()->getUser();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
$nav = new AphrontSideNavFilterView();
|
$nav = new AphrontSideNavFilterView();
|
||||||
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
||||||
|
|
||||||
id(new FundInitiativeSearchEngine())
|
id(new FundInitiativeSearchEngine())
|
||||||
->setViewer($user)
|
->setViewer($viewer)
|
||||||
->addNavigationItems($nav->getMenu());
|
->addNavigationItems($nav->getMenu());
|
||||||
|
|
||||||
$nav->addLabel(pht('Backers'));
|
$nav->addLabel(pht('Backers'));
|
||||||
|
|
|
@ -3,23 +3,18 @@
|
||||||
final class FundInitiativeViewController
|
final class FundInitiativeViewController
|
||||||
extends FundController {
|
extends FundController {
|
||||||
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
$viewer = $request->getViewer();
|
||||||
$viewer = $request->getUser();
|
$id = $request->getURIData('id');
|
||||||
|
|
||||||
$initiative = id(new FundInitiativeQuery())
|
$initiative = id(new FundInitiativeQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$initiative) {
|
if (!$initiative) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
|
Loading…
Reference in a new issue