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

Summary: Run through and update Pholio

Test Plan: New Mock, Edit Mock, Inline Comment, Normal Comment, replace mock, view lists.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

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

+67 -102
+2 -3
src/applications/pholio/controller/PholioImageUploadController.php
··· 2 2 3 3 final class PholioImageUploadController extends PholioController { 4 4 5 - public function processRequest() { 6 - $request = $this->getRequest(); 7 - $viewer = $request->getUser(); 5 + public function handleRequest(AphrontRequest $request) { 6 + $viewer = $request->getViewer(); 8 7 9 8 $phid = $request->getStr('filePHID'); 10 9 $replaces_phid = $request->getStr('replacesPHID');
+5 -11
src/applications/pholio/controller/PholioInlineController.php
··· 2 2 3 3 final class PholioInlineController extends PholioController { 4 4 5 - private $id; 6 - 7 - public function willProcessRequest(array $data) { 8 - $this->id = idx($data, 'id'); 9 - } 10 - 11 - public function processRequest() { 12 - $request = $this->getRequest(); 13 - $viewer = $request->getUser(); 5 + public function handleRequest(AphrontRequest $request) { 6 + $viewer = $request->getViewer(); 7 + $id = $request->getURIData('id'); 14 8 15 - if ($this->id) { 16 - $inline = id(new PholioTransactionComment())->load($this->id); 9 + if ($id) { 10 + $inline = id(new PholioTransactionComment())->load($id); 17 11 18 12 if (!$inline) { 19 13 return new Aphront404Response();
+7 -13
src/applications/pholio/controller/PholioInlineListController.php
··· 2 2 3 3 final class PholioInlineListController extends PholioController { 4 4 5 - private $id; 6 - 7 - public function willProcessRequest(array $data) { 8 - $this->id = $data['id']; 9 - } 10 - 11 - public function processRequest() { 12 - $request = $this->getRequest(); 13 - $user = $request->getUser(); 5 + public function handleRequest(AphrontRequest $request) { 6 + $viewer = $request->getViewer(); 7 + $id = $request->getURIData('id'); 14 8 15 9 $image = id(new PholioImageQuery()) 16 - ->setViewer($user) 17 - ->withIDs(array($this->id)) 10 + ->setViewer($viewer) 11 + ->withIDs(array($id)) 18 12 ->executeOne(); 19 13 if (!$image) { 20 14 return new Aphront404Response(); ··· 23 17 $inline_comments = id(new PholioTransactionComment())->loadAllWhere( 24 18 'imageid = %d AND (transactionphid IS NOT NULL 25 19 OR (authorphid = %s AND transactionphid IS NULL))', 26 - $this->id, 27 - $user->getPHID()); 20 + $id, 21 + $viewer->getPHID()); 28 22 29 23 $author_phids = mpull($inline_comments, 'getAuthorPHID'); 30 24 $authors = $this->loadViewerHandles($author_phids);
+8 -14
src/applications/pholio/controller/PholioMockCommentController.php
··· 2 2 3 3 final class PholioMockCommentController extends PholioController { 4 4 5 - private $id; 6 - 7 - public function willProcessRequest(array $data) { 8 - $this->id = $data['id']; 9 - } 10 - 11 - public function processRequest() { 12 - $request = $this->getRequest(); 13 - $user = $request->getUser(); 5 + public function handleRequest(AphrontRequest $request) { 6 + $viewer = $request->getViewer(); 7 + $id = $request->getURIData('id'); 14 8 15 9 if (!$request->isFormPost()) { 16 10 return new Aphront400Response(); 17 11 } 18 12 19 13 $mock = id(new PholioMockQuery()) 20 - ->setViewer($user) 21 - ->withIDs(array($this->id)) 14 + ->setViewer($viewer) 15 + ->withIDs(array($id)) 22 16 ->needImages(true) 23 17 ->executeOne(); 24 18 ··· 38 32 39 33 $inline_comments = id(new PholioTransactionComment())->loadAllWhere( 40 34 'authorphid = %s AND transactionphid IS NULL AND imageid IN (%Ld)', 41 - $user->getPHID(), 35 + $viewer->getPHID(), 42 36 mpull($mock->getImages(), 'getID')); 43 37 44 38 if (!$inline_comments || strlen($comment)) { ··· 56 50 } 57 51 58 52 $editor = id(new PholioMockEditor()) 59 - ->setActor($user) 53 + ->setActor($viewer) 60 54 ->setContentSourceFromRequest($request) 61 55 ->setContinueOnNoEffect($request->isContinueRequest()) 62 56 ->setIsPreview($is_preview); ··· 78 72 ->setMock($mock); 79 73 80 74 return id(new PhabricatorApplicationTransactionResponse()) 81 - ->setViewer($user) 75 + ->setViewer($viewer) 82 76 ->setTransactions($xactions) 83 77 ->setTransactionView($xaction_view) 84 78 ->setIsPreview($is_preview);
+19 -25
src/applications/pholio/controller/PholioMockEditController.php
··· 2 2 3 3 final class PholioMockEditController extends PholioController { 4 4 5 - private $id; 6 - 7 - public function willProcessRequest(array $data) { 8 - $this->id = idx($data, 'id'); 9 - } 10 - 11 - public function processRequest() { 12 - $request = $this->getRequest(); 13 - $user = $request->getUser(); 5 + public function handleRequest(AphrontRequest $request) { 6 + $viewer = $request->getViewer(); 7 + $id = $request->getURIData('id'); 14 8 15 - if ($this->id) { 9 + if ($id) { 16 10 $mock = id(new PholioMockQuery()) 17 - ->setViewer($user) 11 + ->setViewer($viewer) 18 12 ->needImages(true) 19 13 ->requireCapabilities( 20 14 array( 21 15 PhabricatorPolicyCapability::CAN_VIEW, 22 16 PhabricatorPolicyCapability::CAN_EDIT, 23 17 )) 24 - ->withIDs(array($this->id)) 18 + ->withIDs(array($id)) 25 19 ->executeOne(); 26 20 27 21 if (!$mock) { ··· 35 29 $files = mpull($mock_images, 'getFile'); 36 30 $mock_images = mpull($mock_images, null, 'getFilePHID'); 37 31 } else { 38 - $mock = PholioMock::initializeNewMock($user); 32 + $mock = PholioMock::initializeNewMock($viewer); 39 33 40 34 $title = pht('Create Mock'); 41 35 ··· 104 98 $file_phids = $request->getArr('file_phids'); 105 99 if ($file_phids) { 106 100 $files = id(new PhabricatorFileQuery()) 107 - ->setViewer($user) 101 + ->setViewer($viewer) 108 102 ->withPHIDs($file_phids) 109 103 ->execute(); 110 104 $files = mpull($files, null, 'getPHID'); ··· 219 213 $editor = id(new PholioMockEditor()) 220 214 ->setContentSourceFromRequest($request) 221 215 ->setContinueOnNoEffect(true) 222 - ->setActor($user); 216 + ->setActor($viewer); 223 217 224 218 $xactions = $editor->applyTransactions($mock, $xactions); 225 219 ··· 230 224 } 231 225 } 232 226 233 - if ($this->id) { 227 + if ($id) { 234 228 $submit = id(new AphrontFormSubmitControl()) 235 - ->addCancelButton('/M'.$this->id) 229 + ->addCancelButton('/M'.$id) 236 230 ->setValue(pht('Save')); 237 231 } else { 238 232 $submit = id(new AphrontFormSubmitControl()) ··· 241 235 } 242 236 243 237 $policies = id(new PhabricatorPolicyQuery()) 244 - ->setViewer($user) 238 + ->setViewer($viewer) 245 239 ->setObject($mock) 246 240 ->execute(); 247 241 ··· 257 251 } 258 252 foreach ($display_mock_images as $mock_image) { 259 253 $image_elements[] = id(new PholioUploadedImageView()) 260 - ->setUser($user) 254 + ->setUser($viewer) 261 255 ->setImage($mock_image) 262 256 ->setReplacesPHID($mock_image->getFilePHID()); 263 257 } ··· 308 302 309 303 require_celerity_resource('pholio-edit-css'); 310 304 $form = id(new AphrontFormView()) 311 - ->setUser($user) 305 + ->setUser($viewer) 312 306 ->appendChild($order_control) 313 307 ->appendChild( 314 308 id(new AphrontFormTextControl()) ··· 321 315 ->setName('description') 322 316 ->setValue($v_desc) 323 317 ->setLabel(pht('Description')) 324 - ->setUser($user)); 318 + ->setUser($viewer)); 325 319 326 - if ($this->id) { 320 + if ($id) { 327 321 $form->appendChild( 328 322 id(new AphrontFormSelectControl()) 329 323 ->setLabel(pht('Status')) ··· 346 340 ->setLabel(pht('Subscribers')) 347 341 ->setName('cc') 348 342 ->setValue($v_cc) 349 - ->setUser($user) 343 + ->setUser($viewer) 350 344 ->setDatasource(new PhabricatorMetaMTAMailableDatasource())) 351 345 ->appendChild( 352 346 id(new AphrontFormPolicyControl()) 353 - ->setUser($user) 347 + ->setUser($viewer) 354 348 ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) 355 349 ->setPolicyObject($mock) 356 350 ->setPolicies($policies) ··· 358 352 ->setName('can_view')) 359 353 ->appendChild( 360 354 id(new AphrontFormPolicyControl()) 361 - ->setUser($user) 355 + ->setUser($viewer) 362 356 ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) 363 357 ->setPolicyObject($mock) 364 358 ->setPolicies($policies)
+3 -7
src/applications/pholio/controller/PholioMockListController.php
··· 2 2 3 3 final class PholioMockListController extends PholioController { 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 - } 9 + public function handleRequest(AphrontRequest $request) { 10 + $querykey = $request->getURIData('queryKey'); 14 11 15 - public function processRequest() { 16 12 $controller = id(new PhabricatorApplicationSearchController()) 17 - ->setQueryKey($this->queryKey) 13 + ->setQueryKey($querykey) 18 14 ->setSearchEngine(new PholioMockSearchEngine()) 19 15 ->setNavigation($this->buildSideNavView()); 20 16
+23 -29
src/applications/pholio/controller/PholioMockViewController.php
··· 2 2 3 3 final class PholioMockViewController extends PholioController { 4 4 5 - private $id; 6 - private $imageID; 7 5 private $maniphestTaskPHIDs = array(); 8 6 9 7 private function setManiphestTaskPHIDs($maniphest_task_phids) { ··· 18 16 return true; 19 17 } 20 18 21 - public function willProcessRequest(array $data) { 22 - $this->id = $data['id']; 23 - $this->imageID = idx($data, 'imageID'); 24 - } 25 - 26 - public function processRequest() { 27 - $request = $this->getRequest(); 28 - $user = $request->getUser(); 19 + public function handleRequest(AphrontRequest $request) { 20 + $viewer = $request->getViewer(); 21 + $id = $request->getURIData('id'); 22 + $image_id = $request->getURIData('imageID'); 29 23 30 24 $mock = id(new PholioMockQuery()) 31 - ->setViewer($user) 32 - ->withIDs(array($this->id)) 25 + ->setViewer($viewer) 26 + ->withIDs(array($id)) 33 27 ->needImages(true) 34 28 ->needInlineComments(true) 35 29 ->executeOne(); ··· 44 38 $this->setManiphestTaskPHIDs($phids); 45 39 46 40 $engine = id(new PhabricatorMarkupEngine()) 47 - ->setViewer($user); 41 + ->setViewer($viewer); 48 42 $engine->addObject($mock, PholioMock::MARKUP_FIELD_DESCRIPTION); 49 43 50 44 $title = $mock->getName(); ··· 61 55 62 56 $header = id(new PHUIHeaderView()) 63 57 ->setHeader($title) 64 - ->setUser($user) 58 + ->setUser($viewer) 65 59 ->setStatus($header_icon, $header_color, $header_name) 66 60 ->setPolicyObject($mock); 67 61 ··· 81 75 $mock_view = id(new PholioMockImagesView()) 82 76 ->setRequestURI($request->getRequestURI()) 83 77 ->setCommentFormID($comment_form_id) 84 - ->setUser($user) 78 + ->setUser($viewer) 85 79 ->setMock($mock) 86 - ->setImageID($this->imageID); 80 + ->setImageID($image_id); 87 81 $this->addExtraQuicksandConfig( 88 82 array('mockViewConfig' => $mock_view->getBehaviorConfig())); 89 83 ··· 101 95 ->addPropertyList($properties); 102 96 103 97 $thumb_grid = id(new PholioMockThumbGridView()) 104 - ->setUser($user) 98 + ->setUser($viewer) 105 99 ->setMock($mock); 106 100 107 101 $content = array( ··· 122 116 } 123 117 124 118 private function buildActionView(PholioMock $mock) { 125 - $user = $this->getRequest()->getUser(); 119 + $viewer = $this->getViewer(); 126 120 127 121 $actions = id(new PhabricatorActionListView()) 128 - ->setUser($user) 122 + ->setUser($viewer) 129 123 ->setObjectURI($this->getRequest()->getRequestURI()) 130 124 ->setObject($mock); 131 125 132 126 $can_edit = PhabricatorPolicyFilter::hasCapability( 133 - $user, 127 + $viewer, 134 128 $mock, 135 129 PhabricatorPolicyCapability::CAN_EDIT); 136 130 ··· 147 141 ->setIcon('fa-anchor') 148 142 ->setName(pht('Edit Maniphest Tasks')) 149 143 ->setHref("/search/attach/{$mock->getPHID()}/TASK/edge/") 150 - ->setDisabled(!$user->isLoggedIn()) 144 + ->setDisabled(!$viewer->isLoggedIn()) 151 145 ->setWorkflow(true)); 152 146 153 147 return $actions; ··· 158 152 PhabricatorMarkupEngine $engine, 159 153 PhabricatorActionListView $actions) { 160 154 161 - $user = $this->getRequest()->getUser(); 155 + $viewer = $this->getViewer(); 162 156 163 157 $properties = id(new PHUIPropertyListView()) 164 - ->setUser($user) 158 + ->setUser($viewer) 165 159 ->setObject($mock) 166 160 ->setActionList($actions); 167 161 168 162 $properties->addProperty( 169 163 pht('Author'), 170 - $user->renderHandle($mock->getAuthorPHID())); 164 + $viewer->renderHandle($mock->getAuthorPHID())); 171 165 172 166 $properties->addProperty( 173 167 pht('Created'), 174 - phabricator_datetime($mock->getDateCreated(), $user)); 168 + phabricator_datetime($mock->getDateCreated(), $viewer)); 175 169 176 170 if ($this->getManiphestTaskPHIDs()) { 177 171 $properties->addProperty( 178 172 pht('Maniphest Tasks'), 179 - $user->renderHandleList($this->getManiphestTaskPHIDs())); 173 + $viewer->renderHandleList($this->getManiphestTaskPHIDs())); 180 174 } 181 175 182 176 $properties->invokeWillRenderEvent(); ··· 192 186 } 193 187 194 188 private function buildAddCommentView(PholioMock $mock, $comment_form_id) { 195 - $user = $this->getRequest()->getUser(); 189 + $viewer = $this->getViewer(); 196 190 197 - $draft = PhabricatorDraft::newFromUserAndKey($user, $mock->getPHID()); 191 + $draft = PhabricatorDraft::newFromUserAndKey($viewer, $mock->getPHID()); 198 192 199 193 $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); 200 194 $title = $is_serious ··· 202 196 : pht('History Beckons'); 203 197 204 198 $form = id(new PhabricatorApplicationTransactionCommentView()) 205 - ->setUser($user) 199 + ->setUser($viewer) 206 200 ->setObjectPHID($mock->getPHID()) 207 201 ->setFormID($comment_form_id) 208 202 ->setDraft($draft)