Page MenuHomePhabricator

D13829.id33395.diff
No OneTemporary

D13829.id33395.diff

diff --git a/src/applications/project/controller/PhabricatorProjectArchiveController.php b/src/applications/project/controller/PhabricatorProjectArchiveController.php
--- 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
--- 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 @@
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
--- 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 @@
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
--- 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 @@
array(
PhabricatorPolicyCapability::CAN_VIEW,
))
- ->withIDs(array($this->projectID))
+ ->withIDs(array($project_id))
->needImages(true)
->executeOne();
@@ -32,7 +25,7 @@
$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
--- 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 @@
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
- ->withIDs(array($this->projectID))
+ ->withIDs(array($project_id))
->needImages(true)
->executeOne();
@@ -31,12 +24,12 @@
}
$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 @@
$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
--- 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 @@
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
- ->withIDs(array($this->projectID))
+ ->withIDs(array($project_id))
->executeOne();
if (!$project) {
@@ -31,7 +25,7 @@
$column = id(new PhabricatorProjectColumnQuery())
->setViewer($viewer)
- ->withIDs(array($this->id))
+ ->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
@@ -44,7 +38,7 @@
$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
--- 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
--- 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
--- 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
--- 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
--- 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 @@
->setNewValue($member_spec);
$editor = id(new PhabricatorProjectTransactionEditor($project))
- ->setActor($user)
+ ->setActor($viewer)
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
@@ -75,7 +68,7 @@
}
$can_edit = PhabricatorPolicyFilter::hasCapability(
- $user,
+ $viewer,
$project,
PhabricatorPolicyCapability::CAN_EDIT);
@@ -87,7 +80,7 @@
$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
--- 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
--- 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 @@
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
--- 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 @@
}
$project = id(new PhabricatorProjectQuery())
- ->setViewer($user)
- ->withIDs(array($this->id))
+ ->setViewer($viewer)
+ ->withIDs(array($id))
->needMembers(true)
->requireCapabilities($capabilities)
->executeOne();
@@ -47,7 +40,7 @@
if ($process_action) {
$edge_action = null;
- switch ($this->action) {
+ switch ($action) {
case 'join':
$edge_action = '+';
break;
@@ -58,7 +51,7 @@
$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 @@
->setNewValue($member_spec);
$editor = id(new PhabricatorProjectTransactionEditor($project))
- ->setActor($user)
+ ->setActor($viewer)
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
@@ -78,10 +71,10 @@
}
$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 @@
* 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
--- a/src/applications/project/controller/PhabricatorProjectViewController.php
+++ b/src/applications/project/controller/PhabricatorProjectViewController.php
@@ -9,10 +9,10 @@
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 @@
$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
--- 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 @@
if ($request->isDialogFormPost()) {
$edge_action = null;
- switch ($this->action) {
+ switch ($action) {
case 'watch':
$edge_action = '+';
$force_subscribe = true;
@@ -67,7 +60,7 @@
}
$dialog = null;
- switch ($this->action) {
+ switch ($action) {
case 'watch':
$title = pht('Watch Project?');
$body = pht(

File Metadata

Mime Type
text/plain
Expires
Tue, Jun 25, 11:56 PM (3 d, 4 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6292109
Default Alt Text
D13829.id33395.diff (22 KB)

Event Timeline