@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 Harbormaster for handleRequest

Summary: Updates Harbormaster for handleRequest over processRequest

Test Plan: Went through various Harbormaster areas, buildables, actions.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

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

+22 -46
+10 -19
src/applications/harbormaster/controller/HarbormasterBuildActionController.php
··· 3 3 final class HarbormasterBuildActionController 4 4 extends HarbormasterController { 5 5 6 - private $id; 7 - private $action; 8 - private $via; 9 - 10 - public function willProcessRequest(array $data) { 11 - $this->id = $data['id']; 12 - $this->action = $data['action']; 13 - $this->via = idx($data, 'via'); 14 - } 15 - 16 - public function processRequest() { 17 - $request = $this->getRequest(); 18 - $viewer = $request->getUser(); 19 - $command = $this->action; 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $this->getViewer(); 8 + $id = $request->getURIData('id'); 9 + $action = $request->getURIData('action'); 10 + $via = $request->getURIData('via'); 20 11 21 12 $build = id(new HarbormasterBuildQuery()) 22 13 ->setViewer($viewer) 23 - ->withIDs(array($this->id)) 14 + ->withIDs(array($id)) 24 15 ->requireCapabilities( 25 16 array( 26 17 PhabricatorPolicyCapability::CAN_VIEW, ··· 31 22 return new Aphront404Response(); 32 23 } 33 24 34 - switch ($command) { 25 + switch ($action) { 35 26 case HarbormasterBuildCommand::COMMAND_RESTART: 36 27 $can_issue = $build->canRestartBuild(); 37 28 break; ··· 48 39 return new Aphront400Response(); 49 40 } 50 41 51 - switch ($this->via) { 42 + switch ($via) { 52 43 case 'buildable': 53 44 $return_uri = '/'.$build->getBuildable()->getMonogram(); 54 45 break; ··· 66 57 67 58 $xaction = id(new HarbormasterBuildTransaction()) 68 59 ->setTransactionType(HarbormasterBuildTransaction::TYPE_COMMAND) 69 - ->setNewValue($command); 60 + ->setNewValue($action); 70 61 71 62 $editor->applyTransactions($build, array($xaction)); 72 63 73 64 return id(new AphrontRedirectResponse())->setURI($return_uri); 74 65 } 75 66 76 - switch ($command) { 67 + switch ($action) { 77 68 case HarbormasterBuildCommand::COMMAND_RESTART: 78 69 if ($can_issue) { 79 70 $title = pht('Really restart build?');
+9 -17
src/applications/harbormaster/controller/HarbormasterBuildableActionController.php
··· 3 3 final class HarbormasterBuildableActionController 4 4 extends HarbormasterController { 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(); 17 - $command = $this->action; 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $this->getViewer(); 8 + $id = $request->getURIData('id'); 9 + $action = $request->getURIData('action'); 18 10 19 11 $buildable = id(new HarbormasterBuildableQuery()) 20 12 ->setViewer($viewer) 21 - ->withIDs(array($this->id)) 13 + ->withIDs(array($id)) 22 14 ->needBuilds(true) 23 15 ->requireCapabilities( 24 16 array( ··· 33 25 $issuable = array(); 34 26 35 27 foreach ($buildable->getBuilds() as $build) { 36 - switch ($command) { 28 + switch ($action) { 37 29 case HarbormasterBuildCommand::COMMAND_RESTART: 38 30 if ($build->canRestartBuild()) { 39 31 $issuable[] = $build; ··· 69 61 70 62 $xaction = id(new HarbormasterBuildableTransaction()) 71 63 ->setTransactionType(HarbormasterBuildableTransaction::TYPE_COMMAND) 72 - ->setNewValue($command); 64 + ->setNewValue($action); 73 65 74 66 $editor->applyTransactions($buildable, array($xaction)); 75 67 ··· 82 74 foreach ($issuable as $build) { 83 75 $xaction = id(new HarbormasterBuildTransaction()) 84 76 ->setTransactionType(HarbormasterBuildTransaction::TYPE_COMMAND) 85 - ->setNewValue($command); 77 + ->setNewValue($action); 86 78 $build_editor->applyTransactions($build, array($xaction)); 87 79 } 88 80 89 81 return id(new AphrontRedirectResponse())->setURI($return_uri); 90 82 } 91 83 92 - switch ($command) { 84 + switch ($action) { 93 85 case HarbormasterBuildCommand::COMMAND_RESTART: 94 86 if ($issuable) { 95 87 $title = pht('Really restart all builds?');
+2 -8
src/applications/harbormaster/controller/HarbormasterBuildableListController.php
··· 2 2 3 3 final class HarbormasterBuildableListController extends HarbormasterController { 4 4 5 - private $queryKey; 6 - 7 5 public function shouldAllowPublic() { 8 6 return true; 9 7 } 10 8 11 - public function willProcessRequest(array $data) { 12 - $this->queryKey = idx($data, 'queryKey'); 13 - } 14 - 15 - public function processRequest() { 9 + public function handleRequest(AphrontRequest $request) { 16 10 $controller = id(new PhabricatorApplicationSearchController()) 17 - ->setQueryKey($this->queryKey) 11 + ->setQueryKey($request->getURIData('queryKey')) 18 12 ->setSearchEngine(new HarbormasterBuildableSearchEngine()) 19 13 ->setNavigation($this->buildSideNavView()); 20 14
-1
src/applications/harbormaster/controller/HarbormasterPlanViewController.php
··· 4 4 5 5 public function handleRequest(AphrontRequest $request) { 6 6 $viewer = $this->getviewer(); 7 - 8 7 $id = $request->getURIData('id'); 9 8 10 9 $plan = id(new HarbormasterBuildPlanQuery())
+1 -1
src/applications/harbormaster/controller/HarbormasterStepEditController.php
··· 4 4 5 5 public function handleRequest(AphrontRequest $request) { 6 6 $viewer = $this->getViewer(); 7 + $id = $request->getURIData('id'); 7 8 8 9 $this->requireApplicationCapability( 9 10 HarbormasterManagePlansCapability::CAPABILITY); 10 11 11 - $id = $request->getURIData('id'); 12 12 if ($id) { 13 13 $step = id(new HarbormasterBuildStepQuery()) 14 14 ->setViewer($viewer)