@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update Project for handleRequest

Summary: Updates Projects to use handleRequest

Test Plan: New Project, Edit Project, Archive, Watch, Create Workboards, Import Workboards, Edit Column, New Column, Change Icon, Add/Remove Members

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D13829

+90 -185
+4 -10
src/applications/project/controller/PhabricatorProjectArchiveController.php
··· 3 3 final class PhabricatorProjectArchiveController 4 4 extends PhabricatorProjectController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 10 $project = id(new PhabricatorProjectQuery()) 17 11 ->setViewer($viewer) 18 - ->withIDs(array($this->id)) 12 + ->withIDs(array($id)) 19 13 ->requireCapabilities( 20 14 array( 21 15 PhabricatorPolicyCapability::CAN_VIEW,
+4 -10
src/applications/project/controller/PhabricatorProjectBoardImportController.php
··· 3 3 final class PhabricatorProjectBoardImportController 4 4 extends PhabricatorProjectBoardController { 5 5 6 - private $projectID; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->projectID = $data['projectID']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $project_id = $request->getURIData('projectID'); 15 9 16 10 $project = id(new PhabricatorProjectQuery()) 17 11 ->setViewer($viewer) ··· 20 14 PhabricatorPolicyCapability::CAN_VIEW, 21 15 PhabricatorPolicyCapability::CAN_EDIT, 22 16 )) 23 - ->withIDs(array($this->projectID)) 17 + ->withIDs(array($project_id)) 24 18 ->executeOne(); 25 19 if (!$project) { 26 20 return new Aphront404Response();
+4 -12
src/applications/project/controller/PhabricatorProjectBoardReorderController.php
··· 3 3 final class PhabricatorProjectBoardReorderController 4 4 extends PhabricatorProjectBoardController { 5 5 6 - private $projectID; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->projectID = $data['projectID']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $projectid = $request->getURIData('projectID'); 15 9 16 10 $project = id(new PhabricatorProjectQuery()) 17 11 ->setViewer($viewer) ··· 20 14 PhabricatorPolicyCapability::CAN_VIEW, 21 15 PhabricatorPolicyCapability::CAN_EDIT, 22 16 )) 23 - ->withIDs(array($this->projectID)) 17 + ->withIDs(array($projectid)) 24 18 ->executeOne(); 25 19 if (!$project) { 26 20 return new Aphront404Response(); 27 21 } 28 22 29 23 $this->setProject($project); 30 - 31 - 32 24 $project_id = $project->getID(); 33 25 34 26 $board_uri = $this->getApplicationURI("board/{$project_id}/");
+6 -13
src/applications/project/controller/PhabricatorProjectColumnDetailController.php
··· 3 3 final class PhabricatorProjectColumnDetailController 4 4 extends PhabricatorProjectBoardController { 5 5 6 - private $id; 7 - private $projectID; 8 - 9 - public function willProcessRequest(array $data) { 10 - $this->projectID = $data['projectID']; 11 - $this->id = idx($data, 'id'); 12 - } 13 - 14 - public function processRequest() { 15 - $request = $this->getRequest(); 16 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 9 + $project_id = $request->getURIData('projectID'); 17 10 18 11 $project = id(new PhabricatorProjectQuery()) 19 12 ->setViewer($viewer) ··· 21 14 array( 22 15 PhabricatorPolicyCapability::CAN_VIEW, 23 16 )) 24 - ->withIDs(array($this->projectID)) 17 + ->withIDs(array($project_id)) 25 18 ->needImages(true) 26 19 ->executeOne(); 27 20 ··· 32 25 33 26 $column = id(new PhabricatorProjectColumnQuery()) 34 27 ->setViewer($viewer) 35 - ->withIDs(array($this->id)) 28 + ->withIDs(array($id)) 36 29 ->requireCapabilities( 37 30 array( 38 31 PhabricatorPolicyCapability::CAN_VIEW,
+9 -16
src/applications/project/controller/PhabricatorProjectColumnEditController.php
··· 3 3 final class PhabricatorProjectColumnEditController 4 4 extends PhabricatorProjectBoardController { 5 5 6 - private $id; 7 - private $projectID; 8 - 9 - public function willProcessRequest(array $data) { 10 - $this->projectID = $data['projectID']; 11 - $this->id = idx($data, 'id'); 12 - } 13 - 14 - public function processRequest() { 15 - $request = $this->getRequest(); 16 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 9 + $project_id = $request->getURIData('projectID'); 17 10 18 11 $project = id(new PhabricatorProjectQuery()) 19 12 ->setViewer($viewer) ··· 22 15 PhabricatorPolicyCapability::CAN_VIEW, 23 16 PhabricatorPolicyCapability::CAN_EDIT, 24 17 )) 25 - ->withIDs(array($this->projectID)) 18 + ->withIDs(array($project_id)) 26 19 ->needImages(true) 27 20 ->executeOne(); 28 21 ··· 31 24 } 32 25 $this->setProject($project); 33 26 34 - $is_new = ($this->id ? false : true); 27 + $is_new = ($id ? false : true); 35 28 36 29 if (!$is_new) { 37 30 $column = id(new PhabricatorProjectColumnQuery()) 38 31 ->setViewer($viewer) 39 - ->withIDs(array($this->id)) 32 + ->withIDs(array($id)) 40 33 ->requireCapabilities( 41 34 array( 42 35 PhabricatorPolicyCapability::CAN_VIEW, ··· 57 50 $v_name = $column->getName(); 58 51 59 52 $validation_exception = null; 60 - $base_uri = '/board/'.$this->projectID.'/'; 53 + $base_uri = '/board/'.$project_id.'/'; 61 54 if ($is_new) { 62 55 // we want to go back to the board 63 56 $view_uri = $this->getApplicationURI($base_uri); 64 57 } else { 65 - $view_uri = $this->getApplicationURI($base_uri.'column/'.$this->id.'/'); 58 + $view_uri = $this->getApplicationURI($base_uri.'column/'.$id.'/'); 66 59 } 67 60 68 61 if ($request->isFormPost()) {
+7 -13
src/applications/project/controller/PhabricatorProjectColumnHideController.php
··· 3 3 final class PhabricatorProjectColumnHideController 4 4 extends PhabricatorProjectBoardController { 5 5 6 - private $id; 7 - private $projectID; 8 - 9 - public function willProcessRequest(array $data) { 10 - $this->projectID = $data['projectID']; 11 - $this->id = idx($data, 'id'); 12 - } 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 9 + $project_id = $request->getURIData('projectID'); 13 10 14 - public function processRequest() { 15 - $request = $this->getRequest(); 16 - $viewer = $request->getUser(); 17 11 $project = id(new PhabricatorProjectQuery()) 18 12 ->setViewer($viewer) 19 13 ->requireCapabilities( ··· 21 15 PhabricatorPolicyCapability::CAN_VIEW, 22 16 PhabricatorPolicyCapability::CAN_EDIT, 23 17 )) 24 - ->withIDs(array($this->projectID)) 18 + ->withIDs(array($project_id)) 25 19 ->executeOne(); 26 20 27 21 if (!$project) { ··· 31 25 32 26 $column = id(new PhabricatorProjectColumnQuery()) 33 27 ->setViewer($viewer) 34 - ->withIDs(array($this->id)) 28 + ->withIDs(array($id)) 35 29 ->requireCapabilities( 36 30 array( 37 31 PhabricatorPolicyCapability::CAN_VIEW, ··· 44 38 45 39 $column_phid = $column->getPHID(); 46 40 47 - $view_uri = $this->getApplicationURI('/board/'.$this->projectID.'/'); 41 + $view_uri = $this->getApplicationURI('/board/'.$project_id.'/'); 48 42 $view_uri = new PhutilURI($view_uri); 49 43 foreach ($request->getPassthroughRequestData() as $key => $value) { 50 44 $view_uri->setQueryParam($key, $value);
+5 -11
src/applications/project/controller/PhabricatorProjectEditDetailsController.php
··· 3 3 final class PhabricatorProjectEditDetailsController 4 4 extends PhabricatorProjectController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = idx($data, 'id'); 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 - if ($this->id) { 10 + if ($id) { 17 11 $id = $request->getURIData('id'); 18 12 $is_new = false; 19 13 20 14 $project = id(new PhabricatorProjectQuery()) 21 15 ->setViewer($viewer) 22 - ->withIDs(array($this->id)) 16 + ->withIDs(array($id)) 23 17 ->needSlugs(true) 24 18 ->needImages(true) 25 19 ->requireCapabilities(
+5 -11
src/applications/project/controller/PhabricatorProjectEditIconController.php
··· 3 3 final class PhabricatorProjectEditIconController 4 4 extends PhabricatorProjectController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = idx($data, 'id'); 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 - if ($this->id) { 10 + if ($id) { 17 11 $project = id(new PhabricatorProjectQuery()) 18 12 ->setViewer($viewer) 19 - ->withIDs(array($this->id)) 13 + ->withIDs(array($id)) 20 14 ->requireCapabilities( 21 15 array( 22 16 PhabricatorPolicyCapability::CAN_VIEW,
+3 -10
src/applications/project/controller/PhabricatorProjectEditPictureController.php
··· 3 3 final class PhabricatorProjectEditPictureController 4 4 extends PhabricatorProjectController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 15 8 $id = $request->getURIData('id'); 16 9 17 10 $project = id(new PhabricatorProjectQuery()) 18 11 ->setViewer($viewer) 19 - ->withIDs(array($this->id)) 12 + ->withIDs(array($id)) 20 13 ->needImages(true) 21 14 ->requireCapabilities( 22 15 array(
+4 -7
src/applications/project/controller/PhabricatorProjectListController.php
··· 3 3 final class PhabricatorProjectListController 4 4 extends PhabricatorProjectController { 5 5 6 - private $queryKey; 7 - 8 6 public function shouldAllowPublic() { 9 7 return true; 10 8 } 11 9 12 - public function willProcessRequest(array $data) { 13 - $this->queryKey = idx($data, 'queryKey'); 14 - } 10 + public function handleRequest(AphrontRequest $request) { 11 + $viewer = $request->getViewer(); 12 + $query_key = $request->getURIData('queryKey'); 15 13 16 - public function processRequest() { 17 14 $controller = id(new PhabricatorApplicationSearchController()) 18 - ->setQueryKey($this->queryKey) 15 + ->setQueryKey($query_key) 19 16 ->setSearchEngine(new PhabricatorProjectSearchEngine()) 20 17 ->setNavigation($this->buildSideNavView()); 21 18
+7 -14
src/applications/project/controller/PhabricatorProjectMembersEditController.php
··· 3 3 final class PhabricatorProjectMembersEditController 4 4 extends PhabricatorProjectController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $user = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 15 8 $id = $request->getURIData('id'); 16 9 17 10 $project = id(new PhabricatorProjectQuery()) 18 - ->setViewer($user) 19 - ->withIDs(array($this->id)) 11 + ->setViewer($viewer) 12 + ->withIDs(array($id)) 20 13 ->needMembers(true) 21 14 ->needImages(true) 22 15 ->requireCapabilities( ··· 53 46 ->setNewValue($member_spec); 54 47 55 48 $editor = id(new PhabricatorProjectTransactionEditor($project)) 56 - ->setActor($user) 49 + ->setActor($viewer) 57 50 ->setContentSourceFromRequest($request) 58 51 ->setContinueOnNoEffect(true) 59 52 ->setContinueOnMissingFields(true) ··· 75 68 } 76 69 77 70 $can_edit = PhabricatorPolicyFilter::hasCapability( 78 - $user, 71 + $viewer, 79 72 $project, 80 73 PhabricatorPolicyCapability::CAN_EDIT); 81 74 ··· 87 80 88 81 $form = new AphrontFormView(); 89 82 $form 90 - ->setUser($user) 83 + ->setUser($viewer) 91 84 ->appendControl( 92 85 id(new AphrontFormTokenizerControl()) 93 86 ->setName('phids')
+4 -10
src/applications/project/controller/PhabricatorProjectMembersRemoveController.php
··· 3 3 final class PhabricatorProjectMembersRemoveController 4 4 extends PhabricatorProjectController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 10 $project = id(new PhabricatorProjectQuery()) 17 11 ->setViewer($viewer) 18 - ->withIDs(array($this->id)) 12 + ->withIDs(array($id)) 19 13 ->needMembers(true) 20 14 ->requireCapabilities( 21 15 array(
+4 -10
src/applications/project/controller/PhabricatorProjectMoveController.php
··· 3 3 final class PhabricatorProjectMoveController 4 4 extends PhabricatorProjectController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 10 $column_phid = $request->getStr('columnPHID'); 17 11 $object_phid = $request->getStr('objectPHID'); ··· 26 20 array( 27 21 PhabricatorPolicyCapability::CAN_VIEW, 28 22 )) 29 - ->withIDs(array($this->id)) 23 + ->withIDs(array($id)) 30 24 ->executeOne(); 31 25 if (!$project) { 32 26 return new Aphront404Response();
+14 -21
src/applications/project/controller/PhabricatorProjectUpdateController.php
··· 3 3 final class PhabricatorProjectUpdateController 4 4 extends PhabricatorProjectController { 5 5 6 - private $id; 7 - private $action; 8 - 9 - public function willProcessRequest(array $data) { 10 - $this->id = $data['id']; 11 - $this->action = $data['action']; 12 - } 13 - 14 - public function processRequest() { 15 - $request = $this->getRequest(); 16 - $user = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 9 + $action = $request->getURIData('action'); 17 10 18 11 $capabilities = array( 19 12 PhabricatorPolicyCapability::CAN_VIEW, 20 13 ); 21 14 22 15 $process_action = false; 23 - switch ($this->action) { 16 + switch ($action) { 24 17 case 'join': 25 18 $capabilities[] = PhabricatorPolicyCapability::CAN_JOIN; 26 19 $process_action = $request->isFormPost(); ··· 33 26 } 34 27 35 28 $project = id(new PhabricatorProjectQuery()) 36 - ->setViewer($user) 37 - ->withIDs(array($this->id)) 29 + ->setViewer($viewer) 30 + ->withIDs(array($id)) 38 31 ->needMembers(true) 39 32 ->requireCapabilities($capabilities) 40 33 ->executeOne(); ··· 47 40 if ($process_action) { 48 41 49 42 $edge_action = null; 50 - switch ($this->action) { 43 + switch ($action) { 51 44 case 'join': 52 45 $edge_action = '+'; 53 46 break; ··· 58 51 59 52 $type_member = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; 60 53 $member_spec = array( 61 - $edge_action => array($user->getPHID() => $user->getPHID()), 54 + $edge_action => array($viewer->getPHID() => $viewer->getPHID()), 62 55 ); 63 56 64 57 $xactions = array(); ··· 68 61 ->setNewValue($member_spec); 69 62 70 63 $editor = id(new PhabricatorProjectTransactionEditor($project)) 71 - ->setActor($user) 64 + ->setActor($viewer) 72 65 ->setContentSourceFromRequest($request) 73 66 ->setContinueOnNoEffect(true) 74 67 ->setContinueOnMissingFields(true) ··· 78 71 } 79 72 80 73 $dialog = null; 81 - switch ($this->action) { 74 + switch ($action) { 82 75 case 'leave': 83 76 $dialog = new AphrontDialogView(); 84 - $dialog->setUser($user); 77 + $dialog->setUser($viewer); 85 78 if ($this->userCannotLeave($project)) { 86 79 $dialog->setTitle(pht('You can not leave this project.')); 87 80 $body = pht('The membership is locked for this project.'); ··· 107 100 * this logic to render a better form for users hitting this case. 108 101 */ 109 102 private function userCannotLeave(PhabricatorProject $project) { 110 - $user = $this->getRequest()->getUser(); 103 + $viewer = $this->getViewer(); 111 104 112 105 return 113 106 $project->getIsMembershipLocked() && 114 107 !PhabricatorPolicyFilter::hasCapability( 115 - $user, 108 + $viewer, 116 109 $project, 117 110 PhabricatorPolicyCapability::CAN_EDIT); 118 111 }
+3 -3
src/applications/project/controller/PhabricatorProjectViewController.php
··· 9 9 10 10 public function handleRequest(AphrontRequest $request) { 11 11 $request = $this->getRequest(); 12 - $user = $request->getUser(); 12 + $viewer = $request->getViewer(); 13 13 14 14 $query = id(new PhabricatorProjectQuery()) 15 - ->setViewer($user) 15 + ->setViewer($viewer) 16 16 ->needMembers(true) 17 17 ->needWatchers(true) 18 18 ->needImages(true) ··· 31 31 32 32 33 33 $columns = id(new PhabricatorProjectColumnQuery()) 34 - ->setViewer($user) 34 + ->setViewer($viewer) 35 35 ->withProjectPHIDs(array($project->getPHID())) 36 36 ->execute(); 37 37 if ($columns) {
+7 -14
src/applications/project/controller/PhabricatorProjectWatchController.php
··· 3 3 final class PhabricatorProjectWatchController 4 4 extends PhabricatorProjectController { 5 5 6 - private $id; 7 - private $action; 8 - 9 - public function willProcessRequest(array $data) { 10 - $this->id = $data['id']; 11 - $this->action = $data['action']; 12 - } 13 - 14 - public function processRequest() { 15 - $request = $this->getRequest(); 16 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 9 + $action = $request->getURIData('action'); 17 10 18 11 $project = id(new PhabricatorProjectQuery()) 19 12 ->setViewer($viewer) 20 - ->withIDs(array($this->id)) 13 + ->withIDs(array($id)) 21 14 ->needMembers(true) 22 15 ->needWatchers(true) 23 16 ->executeOne(); ··· 34 27 35 28 if ($request->isDialogFormPost()) { 36 29 $edge_action = null; 37 - switch ($this->action) { 30 + switch ($action) { 38 31 case 'watch': 39 32 $edge_action = '+'; 40 33 $force_subscribe = true; ··· 67 60 } 68 61 69 62 $dialog = null; 70 - switch ($this->action) { 63 + switch ($action) { 71 64 case 'watch': 72 65 $title = pht('Watch Project?'); 73 66 $body = pht(