diff --git a/src/applications/releeph/controller/request/ReleephRequestEditController.php b/src/applications/releeph/controller/request/ReleephRequestEditController.php index 4843e6204d..61cb540795 100644 --- a/src/applications/releeph/controller/request/ReleephRequestEditController.php +++ b/src/applications/releeph/controller/request/ReleephRequestEditController.php @@ -21,7 +21,15 @@ final class ReleephRequestEditController extends ReleephProjectController { // Load the RQ we're editing, or create a new one if ($this->id) { - $rq = id(new ReleephRequest())->load($this->id); + $rq = id(new ReleephRequestQuery()) + ->setViewer($user) + ->withIDs(array($this->id)) + ->requireCapabilities( + array( + PhabricatorPolicyCapability::CAN_VIEW, + PhabricatorPolicyCapability::CAN_EDIT, + )) + ->executeOne(); $is_edit = true; } else { $is_edit = false; @@ -243,27 +251,42 @@ final class ReleephRequestEditController extends ReleephProjectController { } } + $crumbs = $this->buildApplicationCrumbs(); + if ($is_edit) { $title = pht('Edit Releeph Request'); $submit_name = pht('Save'); + + $crumbs->addCrumb( + id(new PhabricatorCrumbView()) + ->setName('RQ'.$rq->getID()) + ->setHref('/RQ'.$rq->getID())); + $crumbs->addCrumb( + id(new PhabricatorCrumbView()) + ->setName(pht('Edit'))); + } else { $title = pht('Create Releeph Request'); $submit_name = pht('Create'); + $crumbs->addCrumb( + id(new PhabricatorCrumbView()) + ->setName(pht('New Request'))); } - $form - ->appendChild( - id(new AphrontFormSubmitControl()) - ->addCancelButton($origin_uri, 'Cancel') - ->setValue($submit_name)); + $form->appendChild( + id(new AphrontFormSubmitControl()) + ->addCancelButton($origin_uri, 'Cancel') + ->setValue($submit_name)); - $panel = id(new AphrontPanelView()) - ->setHeader($title) - ->setWidth(AphrontPanelView::WIDTH_FORM) - ->appendChild($form); - - return $this->buildStandardPageResponse( - array($notice_view, $error_view, $panel), - array('title', $title)); + return $this->buildApplicationPage( + array( + $crumbs, + $notice_view, + $error_view, + $form, + ), + array( + 'title' => $title, + )); } } diff --git a/src/applications/releeph/storage/ReleephRequest.php b/src/applications/releeph/storage/ReleephRequest.php index e8147b87c2..06b7b76564 100644 --- a/src/applications/releeph/storage/ReleephRequest.php +++ b/src/applications/releeph/storage/ReleephRequest.php @@ -125,7 +125,7 @@ final class ReleephRequest extends ReleephDAO public function generatePHID() { return PhabricatorPHID::generateNewPHID( - ReleephPHIDConstants::PHID_TYPE_RERQ); + ReleephPHIDTypeRequest::TYPECONST); } public function save() { @@ -297,6 +297,7 @@ final class ReleephRequest extends ReleephDAO public function getCapabilities() { return array( PhabricatorPolicyCapability::CAN_VIEW, + PhabricatorPolicyCapability::CAN_EDIT, ); }