mirror of
https://we.phorge.it/source/phorge.git
synced 2025-04-04 16:38:24 +02:00
Summary: Ref T10923. Some of the dialogs ("Deactivate Repository", "Test Automation", etc.) had cancel or redirect URIs which I missed originally. Go through them and make sure they all point to the right places. Also removed one unused controller which I missed the first time around. Test Plan: - Opened all these dialogs in a new tab with Command-Click. - Clicked every "cancel" and "submit" button on all of these dialogs. - Got consistently sent to the place I came from. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10923 Differential Revision: https://secure.phabricator.com/D15867
58 lines
1.7 KiB
PHP
58 lines
1.7 KiB
PHP
<?php
|
|
|
|
final class DiffusionRepositoryEditActivateController
|
|
extends DiffusionRepositoryEditController {
|
|
|
|
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->isTracked()) {
|
|
$new_status = PhabricatorRepository::STATUS_ACTIVE;
|
|
} else {
|
|
$new_status = PhabricatorRepository::STATUS_INACTIVE;
|
|
}
|
|
|
|
$xaction = id(new PhabricatorRepositoryTransaction())
|
|
->setTransactionType(PhabricatorRepositoryTransaction::TYPE_ACTIVATE)
|
|
->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);
|
|
}
|
|
|
|
if ($repository->isTracked()) {
|
|
$title = pht('Deactivate Repository');
|
|
$body = pht('Deactivate this repository?');
|
|
$submit = pht('Deactivate Repository');
|
|
} else {
|
|
$title = pht('Activate Repository');
|
|
$body = pht('Activate this repository?');
|
|
$submit = pht('Activate Repository');
|
|
}
|
|
|
|
return $this->newDialog()
|
|
->setTitle($title)
|
|
->appendChild($body)
|
|
->addSubmitButton($submit)
|
|
->addCancelButton($panel_uri);
|
|
}
|
|
|
|
}
|