Modernize most somewhat-weird Diffusion controllers

Summary: Ref T4245. This gets everything else except serving HTTP requests (complicated) and lint (quite weird).

Test Plan:
  - Viewed a diff.
  - Viewed externals.
  - Viewed history table to see last modified.
  - Did path completion and validation in Owners.
  - Did tree path search in Diffusion.
  - Viewed a repository.
  - Created a new repository.
  - Looked up symbols.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4245

Differential Revision: https://secure.phabricator.com/D14947
This commit is contained in:
epriestley
2016-01-05 10:34:04 -08:00
parent 649f882720
commit 3cbc239bc6
10 changed files with 111 additions and 115 deletions

View File

@@ -2,37 +2,29 @@
final class DiffusionPathValidateController extends DiffusionController {
protected function shouldLoadDiffusionRequest() {
return false;
protected function getRepositoryIdentifierFromRequest(
AphrontRequest $request) {
return $request->getStr('repositoryPHID');
}
protected function processDiffusionRequest(AphrontRequest $request) {
$repository_phid = $request->getStr('repositoryPHID');
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($request->getUser())
->withPHIDs(array($repository_phid))
->executeOne();
if (!$repository) {
return new Aphront400Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$path = $request->getStr('path');
$path = ltrim($path, '/');
$drequest = DiffusionRequest::newFromDictionary(
array(
'user' => $request->getUser(),
'repository' => $repository,
'path' => $path,
));
$this->setDiffusionRequest($drequest);
$browse_results = DiffusionBrowseResultSet::newFromConduit(
$this->callConduitWithDiffusionRequest(
'diffusion.browsequery',
array(
'path' => $drequest->getPath(),
'path' => $path,
'commit' => $drequest->getCommit(),
'needValidityOnly' => true,
)));