forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhabricatorProjectColumnRemoveTriggerController.php
60 lines (48 loc) · 1.73 KB
/
PhabricatorProjectColumnRemoveTriggerController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
final class PhabricatorProjectColumnRemoveTriggerController
extends PhabricatorProjectBoardController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$column = id(new PhabricatorProjectColumnQuery())
->setViewer($viewer)
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
if (!$column) {
return new Aphront404Response();
}
$done_uri = $column->getWorkboardURI();
if (!$column->getTriggerPHID()) {
return $this->newDialog()
->setTitle(pht('No Trigger'))
->appendParagraph(
pht('This column does not have a trigger.'))
->addCancelButton($done_uri);
}
if ($request->isFormPost()) {
$column_xactions = array();
$column_xactions[] = $column->getApplicationTransactionTemplate()
->setTransactionType(
PhabricatorProjectColumnTriggerTransaction::TRANSACTIONTYPE)
->setNewValue(null);
$column_editor = $column->getApplicationTransactionEditor()
->setActor($viewer)
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true);
$column_editor->applyTransactions($column, $column_xactions);
return id(new AphrontRedirectResponse())->setURI($done_uri);
}
$body = pht('Really remove the trigger from this column?');
return $this->newDialog()
->setTitle(pht('Remove Trigger'))
->appendParagraph($body)
->addSubmitButton(pht('Remove Trigger'))
->addCancelButton($done_uri);
}
}