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:
epriestley
2016-01-05 08:49:10 -08:00
parent 2bfc5ff92e
commit 649f882720
22 changed files with 236 additions and 403 deletions

View File

@@ -2,7 +2,12 @@
final class DiffusionRepositoryDefaultController extends DiffusionController {
protected function processDiffusionRequest(AphrontRequest $request) {
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
// NOTE: This controller is just here to make sure we call
// willBeginExecution() on any /diffusion/X/ URI, so we can intercept
// `git`, `hg` and `svn` HTTP protocol requests.
@@ -11,7 +16,10 @@ final class DiffusionRepositoryDefaultController extends DiffusionController {
// clone URI with "/anything.git" at the end into their web browser.
// Send them to the canonical repository URI.
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
return id(new AphrontRedirectResponse())
->setURI($this->getDiffusionRequest()->getRepository()->getURI());
->setURI($repository->getURI());
}
}