Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/harbormaster/controller/HarbormasterStepDeleteController.php
12256 views
1
<?php
2
3
final 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
}
43
44