diff --git a/src/applications/project/controller/PhabricatorProjectArchiveController.php b/src/applications/project/controller/PhabricatorProjectArchiveController.php index fdd34a3ea6..d6470ca1eb 100644 --- a/src/applications/project/controller/PhabricatorProjectArchiveController.php +++ b/src/applications/project/controller/PhabricatorProjectArchiveController.php @@ -3,19 +3,13 @@ final class PhabricatorProjectArchiveController extends PhabricatorProjectController { - private $id; - - public function willProcessRequest(array $data) { - $this->id = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $id = $request->getURIData('id'); $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, diff --git a/src/applications/project/controller/PhabricatorProjectBoardImportController.php b/src/applications/project/controller/PhabricatorProjectBoardImportController.php index b11d6efe31..46877b9e14 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardImportController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardImportController.php @@ -3,15 +3,9 @@ final class PhabricatorProjectBoardImportController extends PhabricatorProjectBoardController { - private $projectID; - - public function willProcessRequest(array $data) { - $this->projectID = $data['projectID']; - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $project_id = $request->getURIData('projectID'); $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) @@ -20,7 +14,7 @@ final class PhabricatorProjectBoardImportController PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT, )) - ->withIDs(array($this->projectID)) + ->withIDs(array($project_id)) ->executeOne(); if (!$project) { return new Aphront404Response(); diff --git a/src/applications/project/controller/PhabricatorProjectBoardReorderController.php b/src/applications/project/controller/PhabricatorProjectBoardReorderController.php index 3bd1233909..425c27b5f0 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardReorderController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardReorderController.php @@ -3,15 +3,9 @@ final class PhabricatorProjectBoardReorderController extends PhabricatorProjectBoardController { - private $projectID; - - public function willProcessRequest(array $data) { - $this->projectID = $data['projectID']; - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $projectid = $request->getURIData('projectID'); $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) @@ -20,15 +14,13 @@ final class PhabricatorProjectBoardReorderController PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT, )) - ->withIDs(array($this->projectID)) + ->withIDs(array($projectid)) ->executeOne(); if (!$project) { return new Aphront404Response(); } $this->setProject($project); - - $project_id = $project->getID(); $board_uri = $this->getApplicationURI("board/{$project_id}/"); diff --git a/src/applications/project/controller/PhabricatorProjectColumnDetailController.php b/src/applications/project/controller/PhabricatorProjectColumnDetailController.php index 3a91b55cbd..c44fb5b87c 100644 --- a/src/applications/project/controller/PhabricatorProjectColumnDetailController.php +++ b/src/applications/project/controller/PhabricatorProjectColumnDetailController.php @@ -3,17 +3,10 @@ final class PhabricatorProjectColumnDetailController extends PhabricatorProjectBoardController { - private $id; - private $projectID; - - public function willProcessRequest(array $data) { - $this->projectID = $data['projectID']; - $this->id = idx($data, 'id'); - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $id = $request->getURIData('id'); + $project_id = $request->getURIData('projectID'); $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) @@ -21,7 +14,7 @@ final class PhabricatorProjectColumnDetailController array( PhabricatorPolicyCapability::CAN_VIEW, )) - ->withIDs(array($this->projectID)) + ->withIDs(array($project_id)) ->needImages(true) ->executeOne(); @@ -32,7 +25,7 @@ final class PhabricatorProjectColumnDetailController $column = id(new PhabricatorProjectColumnQuery()) ->setViewer($viewer) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, diff --git a/src/applications/project/controller/PhabricatorProjectColumnEditController.php b/src/applications/project/controller/PhabricatorProjectColumnEditController.php index 28038f5d98..d59c3648fe 100644 --- a/src/applications/project/controller/PhabricatorProjectColumnEditController.php +++ b/src/applications/project/controller/PhabricatorProjectColumnEditController.php @@ -3,17 +3,10 @@ final class PhabricatorProjectColumnEditController extends PhabricatorProjectBoardController { - private $id; - private $projectID; - - public function willProcessRequest(array $data) { - $this->projectID = $data['projectID']; - $this->id = idx($data, 'id'); - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $id = $request->getURIData('id'); + $project_id = $request->getURIData('projectID'); $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) @@ -22,7 +15,7 @@ final class PhabricatorProjectColumnEditController PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT, )) - ->withIDs(array($this->projectID)) + ->withIDs(array($project_id)) ->needImages(true) ->executeOne(); @@ -31,12 +24,12 @@ final class PhabricatorProjectColumnEditController } $this->setProject($project); - $is_new = ($this->id ? false : true); + $is_new = ($id ? false : true); if (!$is_new) { $column = id(new PhabricatorProjectColumnQuery()) ->setViewer($viewer) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, @@ -57,12 +50,12 @@ final class PhabricatorProjectColumnEditController $v_name = $column->getName(); $validation_exception = null; - $base_uri = '/board/'.$this->projectID.'/'; + $base_uri = '/board/'.$project_id.'/'; if ($is_new) { // we want to go back to the board $view_uri = $this->getApplicationURI($base_uri); } else { - $view_uri = $this->getApplicationURI($base_uri.'column/'.$this->id.'/'); + $view_uri = $this->getApplicationURI($base_uri.'column/'.$id.'/'); } if ($request->isFormPost()) { diff --git a/src/applications/project/controller/PhabricatorProjectColumnHideController.php b/src/applications/project/controller/PhabricatorProjectColumnHideController.php index 2e613ee7da..167cbfbd2e 100644 --- a/src/applications/project/controller/PhabricatorProjectColumnHideController.php +++ b/src/applications/project/controller/PhabricatorProjectColumnHideController.php @@ -3,17 +3,11 @@ final class PhabricatorProjectColumnHideController extends PhabricatorProjectBoardController { - private $id; - private $projectID; + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $id = $request->getURIData('id'); + $project_id = $request->getURIData('projectID'); - public function willProcessRequest(array $data) { - $this->projectID = $data['projectID']; - $this->id = idx($data, 'id'); - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) ->requireCapabilities( @@ -21,7 +15,7 @@ final class PhabricatorProjectColumnHideController PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT, )) - ->withIDs(array($this->projectID)) + ->withIDs(array($project_id)) ->executeOne(); if (!$project) { @@ -31,7 +25,7 @@ final class PhabricatorProjectColumnHideController $column = id(new PhabricatorProjectColumnQuery()) ->setViewer($viewer) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, @@ -44,7 +38,7 @@ final class PhabricatorProjectColumnHideController $column_phid = $column->getPHID(); - $view_uri = $this->getApplicationURI('/board/'.$this->projectID.'/'); + $view_uri = $this->getApplicationURI('/board/'.$project_id.'/'); $view_uri = new PhutilURI($view_uri); foreach ($request->getPassthroughRequestData() as $key => $value) { $view_uri->setQueryParam($key, $value); diff --git a/src/applications/project/controller/PhabricatorProjectEditDetailsController.php b/src/applications/project/controller/PhabricatorProjectEditDetailsController.php index af92c60aea..48016845a8 100644 --- a/src/applications/project/controller/PhabricatorProjectEditDetailsController.php +++ b/src/applications/project/controller/PhabricatorProjectEditDetailsController.php @@ -3,23 +3,17 @@ final class PhabricatorProjectEditDetailsController extends PhabricatorProjectController { - private $id; + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $id = $request->getURIData('id'); - public function willProcessRequest(array $data) { - $this->id = idx($data, 'id'); - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); - - if ($this->id) { + if ($id) { $id = $request->getURIData('id'); $is_new = false; $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->needSlugs(true) ->needImages(true) ->requireCapabilities( diff --git a/src/applications/project/controller/PhabricatorProjectEditIconController.php b/src/applications/project/controller/PhabricatorProjectEditIconController.php index c21080d595..fe7e28b4c2 100644 --- a/src/applications/project/controller/PhabricatorProjectEditIconController.php +++ b/src/applications/project/controller/PhabricatorProjectEditIconController.php @@ -3,20 +3,14 @@ final class PhabricatorProjectEditIconController extends PhabricatorProjectController { - private $id; + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $id = $request->getURIData('id'); - public function willProcessRequest(array $data) { - $this->id = idx($data, 'id'); - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); - - if ($this->id) { + if ($id) { $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, diff --git a/src/applications/project/controller/PhabricatorProjectEditPictureController.php b/src/applications/project/controller/PhabricatorProjectEditPictureController.php index ca99159718..6f5128eceb 100644 --- a/src/applications/project/controller/PhabricatorProjectEditPictureController.php +++ b/src/applications/project/controller/PhabricatorProjectEditPictureController.php @@ -3,20 +3,13 @@ final class PhabricatorProjectEditPictureController extends PhabricatorProjectController { - private $id; - - public function willProcessRequest(array $data) { - $this->id = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); $id = $request->getURIData('id'); $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->needImages(true) ->requireCapabilities( array( diff --git a/src/applications/project/controller/PhabricatorProjectListController.php b/src/applications/project/controller/PhabricatorProjectListController.php index 1852f43bfc..ea56036c7b 100644 --- a/src/applications/project/controller/PhabricatorProjectListController.php +++ b/src/applications/project/controller/PhabricatorProjectListController.php @@ -3,19 +3,16 @@ final class PhabricatorProjectListController extends PhabricatorProjectController { - private $queryKey; - public function shouldAllowPublic() { return true; } - public function willProcessRequest(array $data) { - $this->queryKey = idx($data, 'queryKey'); - } + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $query_key = $request->getURIData('queryKey'); - public function processRequest() { $controller = id(new PhabricatorApplicationSearchController()) - ->setQueryKey($this->queryKey) + ->setQueryKey($query_key) ->setSearchEngine(new PhabricatorProjectSearchEngine()) ->setNavigation($this->buildSideNavView()); diff --git a/src/applications/project/controller/PhabricatorProjectMembersEditController.php b/src/applications/project/controller/PhabricatorProjectMembersEditController.php index d033a87394..c7a9144188 100644 --- a/src/applications/project/controller/PhabricatorProjectMembersEditController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersEditController.php @@ -3,20 +3,13 @@ final class PhabricatorProjectMembersEditController extends PhabricatorProjectController { - private $id; - - public function willProcessRequest(array $data) { - $this->id = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); $id = $request->getURIData('id'); $project = id(new PhabricatorProjectQuery()) - ->setViewer($user) - ->withIDs(array($this->id)) + ->setViewer($viewer) + ->withIDs(array($id)) ->needMembers(true) ->needImages(true) ->requireCapabilities( @@ -53,7 +46,7 @@ final class PhabricatorProjectMembersEditController ->setNewValue($member_spec); $editor = id(new PhabricatorProjectTransactionEditor($project)) - ->setActor($user) + ->setActor($viewer) ->setContentSourceFromRequest($request) ->setContinueOnNoEffect(true) ->setContinueOnMissingFields(true) @@ -75,7 +68,7 @@ final class PhabricatorProjectMembersEditController } $can_edit = PhabricatorPolicyFilter::hasCapability( - $user, + $viewer, $project, PhabricatorPolicyCapability::CAN_EDIT); @@ -87,7 +80,7 @@ final class PhabricatorProjectMembersEditController $form = new AphrontFormView(); $form - ->setUser($user) + ->setUser($viewer) ->appendControl( id(new AphrontFormTokenizerControl()) ->setName('phids') diff --git a/src/applications/project/controller/PhabricatorProjectMembersRemoveController.php b/src/applications/project/controller/PhabricatorProjectMembersRemoveController.php index 270dd9a022..cad3f35c05 100644 --- a/src/applications/project/controller/PhabricatorProjectMembersRemoveController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersRemoveController.php @@ -3,19 +3,13 @@ final class PhabricatorProjectMembersRemoveController extends PhabricatorProjectController { - private $id; - - public function willProcessRequest(array $data) { - $this->id = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $id = $request->getURIData('id'); $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->needMembers(true) ->requireCapabilities( array( diff --git a/src/applications/project/controller/PhabricatorProjectMoveController.php b/src/applications/project/controller/PhabricatorProjectMoveController.php index a22050ea77..1b2429917c 100644 --- a/src/applications/project/controller/PhabricatorProjectMoveController.php +++ b/src/applications/project/controller/PhabricatorProjectMoveController.php @@ -3,15 +3,9 @@ final class PhabricatorProjectMoveController extends PhabricatorProjectController { - private $id; - - public function willProcessRequest(array $data) { - $this->id = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $id = $request->getURIData('id'); $column_phid = $request->getStr('columnPHID'); $object_phid = $request->getStr('objectPHID'); @@ -26,7 +20,7 @@ final class PhabricatorProjectMoveController array( PhabricatorPolicyCapability::CAN_VIEW, )) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->executeOne(); if (!$project) { return new Aphront404Response(); diff --git a/src/applications/project/controller/PhabricatorProjectUpdateController.php b/src/applications/project/controller/PhabricatorProjectUpdateController.php index a484b2b670..cfdeb4fd09 100644 --- a/src/applications/project/controller/PhabricatorProjectUpdateController.php +++ b/src/applications/project/controller/PhabricatorProjectUpdateController.php @@ -3,24 +3,17 @@ final class PhabricatorProjectUpdateController extends PhabricatorProjectController { - private $id; - private $action; - - public function willProcessRequest(array $data) { - $this->id = $data['id']; - $this->action = $data['action']; - } - - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $id = $request->getURIData('id'); + $action = $request->getURIData('action'); $capabilities = array( PhabricatorPolicyCapability::CAN_VIEW, ); $process_action = false; - switch ($this->action) { + switch ($action) { case 'join': $capabilities[] = PhabricatorPolicyCapability::CAN_JOIN; $process_action = $request->isFormPost(); @@ -33,8 +26,8 @@ final class PhabricatorProjectUpdateController } $project = id(new PhabricatorProjectQuery()) - ->setViewer($user) - ->withIDs(array($this->id)) + ->setViewer($viewer) + ->withIDs(array($id)) ->needMembers(true) ->requireCapabilities($capabilities) ->executeOne(); @@ -47,7 +40,7 @@ final class PhabricatorProjectUpdateController if ($process_action) { $edge_action = null; - switch ($this->action) { + switch ($action) { case 'join': $edge_action = '+'; break; @@ -58,7 +51,7 @@ final class PhabricatorProjectUpdateController $type_member = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; $member_spec = array( - $edge_action => array($user->getPHID() => $user->getPHID()), + $edge_action => array($viewer->getPHID() => $viewer->getPHID()), ); $xactions = array(); @@ -68,7 +61,7 @@ final class PhabricatorProjectUpdateController ->setNewValue($member_spec); $editor = id(new PhabricatorProjectTransactionEditor($project)) - ->setActor($user) + ->setActor($viewer) ->setContentSourceFromRequest($request) ->setContinueOnNoEffect(true) ->setContinueOnMissingFields(true) @@ -78,10 +71,10 @@ final class PhabricatorProjectUpdateController } $dialog = null; - switch ($this->action) { + switch ($action) { case 'leave': $dialog = new AphrontDialogView(); - $dialog->setUser($user); + $dialog->setUser($viewer); if ($this->userCannotLeave($project)) { $dialog->setTitle(pht('You can not leave this project.')); $body = pht('The membership is locked for this project.'); @@ -107,12 +100,12 @@ final class PhabricatorProjectUpdateController * this logic to render a better form for users hitting this case. */ private function userCannotLeave(PhabricatorProject $project) { - $user = $this->getRequest()->getUser(); + $viewer = $this->getViewer(); return $project->getIsMembershipLocked() && !PhabricatorPolicyFilter::hasCapability( - $user, + $viewer, $project, PhabricatorPolicyCapability::CAN_EDIT); } diff --git a/src/applications/project/controller/PhabricatorProjectViewController.php b/src/applications/project/controller/PhabricatorProjectViewController.php index a974010bc0..45329285df 100644 --- a/src/applications/project/controller/PhabricatorProjectViewController.php +++ b/src/applications/project/controller/PhabricatorProjectViewController.php @@ -9,10 +9,10 @@ final class PhabricatorProjectViewController public function handleRequest(AphrontRequest $request) { $request = $this->getRequest(); - $user = $request->getUser(); + $viewer = $request->getViewer(); $query = id(new PhabricatorProjectQuery()) - ->setViewer($user) + ->setViewer($viewer) ->needMembers(true) ->needWatchers(true) ->needImages(true) @@ -31,7 +31,7 @@ final class PhabricatorProjectViewController $columns = id(new PhabricatorProjectColumnQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withProjectPHIDs(array($project->getPHID())) ->execute(); if ($columns) { diff --git a/src/applications/project/controller/PhabricatorProjectWatchController.php b/src/applications/project/controller/PhabricatorProjectWatchController.php index b1c52e7870..53538f8393 100644 --- a/src/applications/project/controller/PhabricatorProjectWatchController.php +++ b/src/applications/project/controller/PhabricatorProjectWatchController.php @@ -3,21 +3,14 @@ final class PhabricatorProjectWatchController extends PhabricatorProjectController { - private $id; - private $action; - - public function willProcessRequest(array $data) { - $this->id = $data['id']; - $this->action = $data['action']; - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $id = $request->getURIData('id'); + $action = $request->getURIData('action'); $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->needMembers(true) ->needWatchers(true) ->executeOne(); @@ -34,7 +27,7 @@ final class PhabricatorProjectWatchController if ($request->isDialogFormPost()) { $edge_action = null; - switch ($this->action) { + switch ($action) { case 'watch': $edge_action = '+'; $force_subscribe = true; @@ -67,7 +60,7 @@ final class PhabricatorProjectWatchController } $dialog = null; - switch ($this->action) { + switch ($action) { case 'watch': $title = pht('Watch Project?'); $body = pht(