Slightly modernize all Diffusion edit endpoints
Summary: Ref T4245. Prepares edit endpoints for more flexible repository identifiers. Test Plan: - Added, edited, deleted mirror. - Created repository. - Edited basic repository information. - Edited policies for a repository. - Activated/deactivated repository. - Updated a repository. - Hit "Delete" dialog for a repository. - Edited hosting. - Toggled dangerous changes. - Edited branches. - Edited automation. - Tested automation. - Edited storage. - Edited staging. - Edited encoding. - Edited symbols. - Edited branches. - Edited actions. - Tried to do edits as an unprivileged user. Reviewers: chad Reviewed By: chad Maniphest Tasks: T4245 Differential Revision: https://secure.phabricator.com/D14945
This commit is contained in:
@@ -3,24 +3,16 @@
|
||||
final class DiffusionRepositoryEditDeleteController
|
||||
extends DiffusionRepositoryEditController {
|
||||
|
||||
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getUser();
|
||||
$drequest = $this->diffusionRequest;
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$repository = id(new PhabricatorRepositoryQuery())
|
||||
->setViewer($viewer)
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
PhabricatorPolicyCapability::CAN_EDIT,
|
||||
))
|
||||
->withIDs(array($repository->getID()))
|
||||
->executeOne();
|
||||
if (!$repository) {
|
||||
return new Aphront404Response();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$response = $this->loadDiffusionContextForEdit();
|
||||
if ($response) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$viewer = $this->getViewer();
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
|
||||
|
||||
$dialog = new AphrontDialogView();
|
||||
@@ -45,14 +37,10 @@ final class DiffusionRepositoryEditDeleteController
|
||||
phutil_tag('p', array(), $text_2),
|
||||
));
|
||||
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($request->getUser())
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Really want to delete the repository?'))
|
||||
->appendChild($body)
|
||||
->addCancelButton($edit_uri, pht('Okay'));
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user