@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
at recaptime-dev/main 42 lines 1.1 kB view raw
1<?php 2 3final class HarbormasterStepDeleteController 4 extends HarbormasterPlanController { 5 6 public function handleRequest(AphrontRequest $request) { 7 $viewer = $this->getViewer(); 8 9 $id = $request->getURIData('id'); 10 11 $step = id(new HarbormasterBuildStepQuery()) 12 ->setViewer($viewer) 13 ->withIDs(array($id)) 14 ->requireCapabilities( 15 array( 16 PhabricatorPolicyCapability::CAN_VIEW, 17 PhabricatorPolicyCapability::CAN_EDIT, 18 )) 19 ->executeOne(); 20 if (!$step) { 21 return new Aphront404Response(); 22 } 23 24 $plan_id = $step->getBuildPlan()->getID(); 25 $done_uri = $this->getApplicationURI('plan/'.$plan_id.'/'); 26 27 if ($request->isDialogFormPost()) { 28 $step->delete(); 29 return id(new AphrontRedirectResponse())->setURI($done_uri); 30 } 31 32 return $this->newDialog() 33 ->setTitle(pht('Really Delete Step?')) 34 ->appendParagraph( 35 pht( 36 "Are you sure you want to delete this step? ". 37 "This can't be undone!")) 38 ->addCancelButton($done_uri) 39 ->addSubmitButton(pht('Delete Build Step')); 40 } 41 42}