@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 PhabricatorProjectBoardDisableController
4 extends PhabricatorProjectBoardController {
5
6 public function handleRequest(AphrontRequest $request) {
7 $viewer = $request->getUser();
8 $project_id = $request->getURIData('projectID');
9
10 $project = id(new PhabricatorProjectQuery())
11 ->setViewer($viewer)
12 ->requireCapabilities(
13 array(
14 PhabricatorPolicyCapability::CAN_VIEW,
15 PhabricatorPolicyCapability::CAN_EDIT,
16 ))
17 ->withIDs(array($project_id))
18 ->executeOne();
19 if (!$project) {
20 return new Aphront404Response();
21 }
22
23 if (!$project->getHasWorkboard()) {
24 return new Aphront404Response();
25 }
26
27 $this->setProject($project);
28 $id = $project->getID();
29
30 $board_uri = $this->getApplicationURI("board/{$id}/");
31
32 if ($request->isFormPost()) {
33 $xactions = array();
34
35 $xactions[] = id(new PhabricatorProjectTransaction())
36 ->setTransactionType(
37 PhabricatorProjectWorkboardTransaction::TRANSACTIONTYPE)
38 ->setNewValue(0);
39
40 id(new PhabricatorProjectTransactionEditor())
41 ->setActor($viewer)
42 ->setContentSourceFromRequest($request)
43 ->setContinueOnNoEffect(true)
44 ->setContinueOnMissingFields(true)
45 ->applyTransactions($project, $xactions);
46
47 return id(new AphrontRedirectResponse())
48 ->setURI($board_uri);
49 }
50
51 return $this->newDialog()
52 ->setTitle(pht('Disable Workboard'))
53 ->appendParagraph(
54 pht(
55 'Disabling a workboard hides the board. Objects on the board '.
56 'will no longer be annotated with column names in other '.
57 'applications. You can restore the workboard later.'))
58 ->addCancelButton($board_uri)
59 ->addSubmitButton(pht('Disable Workboard'));
60 }
61
62}