@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.

Modernize Releeph Request create/edit controller

Summary: Ref T3092.

Test Plan: Created a new pick request. Edited an existing pick request.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3092

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

+39 -15
+37 -14
src/applications/releeph/controller/request/ReleephRequestEditController.php
··· 21 21 22 22 // Load the RQ we're editing, or create a new one 23 23 if ($this->id) { 24 - $rq = id(new ReleephRequest())->load($this->id); 24 + $rq = id(new ReleephRequestQuery()) 25 + ->setViewer($user) 26 + ->withIDs(array($this->id)) 27 + ->requireCapabilities( 28 + array( 29 + PhabricatorPolicyCapability::CAN_VIEW, 30 + PhabricatorPolicyCapability::CAN_EDIT, 31 + )) 32 + ->executeOne(); 25 33 $is_edit = true; 26 34 } else { 27 35 $is_edit = false; ··· 243 251 } 244 252 } 245 253 254 + $crumbs = $this->buildApplicationCrumbs(); 255 + 246 256 if ($is_edit) { 247 257 $title = pht('Edit Releeph Request'); 248 258 $submit_name = pht('Save'); 259 + 260 + $crumbs->addCrumb( 261 + id(new PhabricatorCrumbView()) 262 + ->setName('RQ'.$rq->getID()) 263 + ->setHref('/RQ'.$rq->getID())); 264 + $crumbs->addCrumb( 265 + id(new PhabricatorCrumbView()) 266 + ->setName(pht('Edit'))); 267 + 249 268 } else { 250 269 $title = pht('Create Releeph Request'); 251 270 $submit_name = pht('Create'); 271 + $crumbs->addCrumb( 272 + id(new PhabricatorCrumbView()) 273 + ->setName(pht('New Request'))); 252 274 } 253 275 254 - $form 255 - ->appendChild( 256 - id(new AphrontFormSubmitControl()) 257 - ->addCancelButton($origin_uri, 'Cancel') 258 - ->setValue($submit_name)); 276 + $form->appendChild( 277 + id(new AphrontFormSubmitControl()) 278 + ->addCancelButton($origin_uri, 'Cancel') 279 + ->setValue($submit_name)); 259 280 260 - $panel = id(new AphrontPanelView()) 261 - ->setHeader($title) 262 - ->setWidth(AphrontPanelView::WIDTH_FORM) 263 - ->appendChild($form); 264 - 265 - return $this->buildStandardPageResponse( 266 - array($notice_view, $error_view, $panel), 267 - array('title', $title)); 281 + return $this->buildApplicationPage( 282 + array( 283 + $crumbs, 284 + $notice_view, 285 + $error_view, 286 + $form, 287 + ), 288 + array( 289 + 'title' => $title, 290 + )); 268 291 } 269 292 }
+2 -1
src/applications/releeph/storage/ReleephRequest.php
··· 125 125 126 126 public function generatePHID() { 127 127 return PhabricatorPHID::generateNewPHID( 128 - ReleephPHIDConstants::PHID_TYPE_RERQ); 128 + ReleephPHIDTypeRequest::TYPECONST); 129 129 } 130 130 131 131 public function save() { ··· 297 297 public function getCapabilities() { 298 298 return array( 299 299 PhabricatorPolicyCapability::CAN_VIEW, 300 + PhabricatorPolicyCapability::CAN_EDIT, 300 301 ); 301 302 } 302 303