phorge/src/applications/project/controller/PhabricatorProjectColumnRemoveTriggerController.php
epriestley ee54e71ba9 On workboards, link ancestor project breadcrumbs to their workboards
Summary:
Ref T13269. Currently, if you're on a milestone workboard like this:

> Projects > Parent > Milestone > Workboard

The "Parent" link goes to the parent profile. More often, I want it to go to the parent workboard. Try doing that? This is kind of one-off but I suspect it's a better rule.

Also, consolidate one billion manual constructions of "/board/" URIs.

Test Plan: Viewed a milestone workboard, clicked the parent link, ended up on the parent workboard.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13269

Differential Revision: https://secure.phabricator.com/D20331
2019-03-27 14:42:57 -07:00

61 lines
1.7 KiB
PHP

<?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);
}
}