Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / diffusion / controller / DiffusionDocumentController.php
blobc8956fc84c9063c4bac63d8245d4b201ac8eee80
1 <?php
3 final class DiffusionDocumentController extends DiffusionController {
5 public function shouldAllowPublic() {
6 return true;
9 public function handleRequest(AphrontRequest $request) {
10 $response = $this->loadDiffusionContext();
11 if ($response) {
12 return $response;
15 $drequest = $this->getDiffusionRequest();
17 $engine = id(new DiffusionDocumentRenderingEngine())
18 ->setRequest($request)
19 ->setDiffusionRequest($drequest)
20 ->setController($this);
22 $viewer = $this->getViewer();
23 $request = $this->getRequest();
24 $repository = $drequest->getRepository();
26 $file_phid = $request->getStr('filePHID');
28 $file = id(new PhabricatorFileQuery())
29 ->setViewer($viewer)
30 ->withPHIDs(array($file_phid))
31 ->executeOne();
32 if (!$file) {
33 return $engine->newErrorResponse(
34 pht(
35 'This file ("%s") does not exist or could not be loaded.',
36 $file_phid));
39 $ref = id(new PhabricatorDocumentRef())
40 ->setFile($file);
42 return $engine->newRenderResponse($ref);