1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-04 20:52:43 +01:00
phorge-phorge/src/applications/diffusion/controller/DiffusionRepositoryEditPublishingController.php
epriestley 7a4ef2bad8 Move the repository "Publishing" option to the "Basics" panel in repository management
Summary:
Depends on D20424. Ref T13277. Now that the "Actions" panel only has one item ("Publishing"), just move it to the "Basics" panel.

Update the UI to show active/publishing status more clearly and relate them to one another and importing state.

Test Plan: {F6378087}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13277

Differential Revision: https://secure.phabricator.com/D20425
2019-04-18 05:24:27 -07:00

83 lines
2.5 KiB
PHP

<?php
final class DiffusionRepositoryEditPublishingController
extends DiffusionRepositoryManageController {
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$panel_uri = id(new DiffusionRepositoryBasicsManagementPanel())
->setRepository($repository)
->getPanelURI();
if ($request->isFormPost()) {
if ($repository->isPublishingDisabled()) {
$new_status = true;
} else {
$new_status = false;
}
$xaction = id(new PhabricatorRepositoryTransaction())
->setTransactionType(
PhabricatorRepositoryNotifyTransaction::TRANSACTIONTYPE)
->setNewValue($new_status);
$editor = id(new PhabricatorRepositoryEditor())
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
->setContentSourceFromRequest($request)
->setActor($viewer)
->applyTransactions($repository, array($xaction));
return id(new AphrontReloadResponse())->setURI($panel_uri);
}
$body = array();
if (!$repository->isPublishingDisabled()) {
$title = pht('Disable Publishing');
$body[] = pht(
'If you disable publishing for this repository, new commits '.
'will not: send email, publish feed stories, trigger audits, or '.
'trigger Herald.');
$body[] = pht(
'This option is most commonly used to temporarily allow a major '.
'repository maintenance operation (like a history rewrite) to '.
'occur with minimal disruption to users.');
$submit = pht('Disable Publishing');
} else {
$title = pht('Reactivate Publishing');
$body[] = pht(
'If you reactivate publishing for this repository, new commits '.
'that become reachable from permanent refs will: send email, '.
'publish feed stories, trigger audits, and trigger Herald.');
$body[] = pht(
'Commits which became reachable from a permanent ref while '.
'publishing was disabled will not trigger these actions '.
'retroactively.');
$submit = pht('Reactivate Publishing');
}
$dialog = $this->newDialog()
->setTitle($title)
->addSubmitButton($submit)
->addCancelButton($panel_uri);
foreach ($body as $graph) {
$dialog->appendParagraph($graph);
}
return $dialog;
}
}