Files - make file info page public

Summary: and for bonus, finesse some URIs a tad. Fixes T5922.

Test Plan: viewed F1 logged out and it worked! viewed the ugly URI for F1 and got redirected to the pretty URI.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5922

Differential Revision: https://secure.phabricator.com/D10309
This commit is contained in:
Bob Trahan
2014-08-20 13:18:21 -07:00
parent 20d6c7a048
commit 8dd4d5cfe5
5 changed files with 21 additions and 31 deletions

View File

@@ -3,20 +3,36 @@
final class PhabricatorFileInfoController extends PhabricatorFileController {
private $phid;
private $id;
public function shouldAllowPublic() {
return true;
}
public function willProcessRequest(array $data) {
$this->phid = $data['phid'];
$this->phid = idx($data, 'phid');
$this->id = idx($data, 'id');
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
if ($this->phid) {
$file = id(new PhabricatorFileQuery())
->setViewer($user)
->withPHIDs(array($this->phid))
->executeOne();
if (!$file) {
return new Aphront404Response();
}
return id(new AphrontRedirectResponse())->setURI($file->getInfoURI());
}
$file = id(new PhabricatorFileQuery())
->setViewer($user)
->withPHIDs(array($this->phid))
->withIDs(array($this->id))
->executeOne();
if (!$file) {
return new Aphront404Response();
}