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