mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 13:52:40 +01:00
Diffusion - return 404 errors for bad URIs
Summary: Fixes T5646. Makes diffusion a much better user experience. Users now see a 404 exception page when they have a bad URI. Previously, they saw a developer-facing raw exception. Test Plan: played around in diffusion a bunch. most of these changes were fairly mechanical at the end of the day. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T5646 Differential Revision: https://secure.phabricator.com/D11299
This commit is contained in:
parent
11a20079ef
commit
a823654be0
45 changed files with 120 additions and 185 deletions
|
@ -6,9 +6,8 @@ final class DiffusionBranchTableController extends DiffusionController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
|
@ -14,7 +14,7 @@ final class DiffusionBrowseDirectoryController
|
||||||
return $this->browseQueryResults;
|
return $this->browseQueryResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
|
|
||||||
$results = $this->getBrowseQueryResults();
|
$results = $this->getBrowseQueryResults();
|
||||||
|
@ -35,7 +35,7 @@ final class DiffusionBrowseDirectoryController
|
||||||
$empty_result = new DiffusionEmptyResultView();
|
$empty_result = new DiffusionEmptyResultView();
|
||||||
$empty_result->setDiffusionRequest($drequest);
|
$empty_result->setDiffusionRequest($drequest);
|
||||||
$empty_result->setDiffusionBrowseResultSet($results);
|
$empty_result->setDiffusionBrowseResultSet($results);
|
||||||
$empty_result->setView($this->getRequest()->getStr('view'));
|
$empty_result->setView($request->getStr('view'));
|
||||||
$content[] = $empty_result;
|
$content[] = $empty_result;
|
||||||
} else {
|
} else {
|
||||||
$phids = array();
|
$phids = array();
|
||||||
|
@ -55,7 +55,7 @@ final class DiffusionBrowseDirectoryController
|
||||||
$browse_table->setDiffusionRequest($drequest);
|
$browse_table->setDiffusionRequest($drequest);
|
||||||
$browse_table->setHandles($handles);
|
$browse_table->setHandles($handles);
|
||||||
$browse_table->setPaths($results->getPaths());
|
$browse_table->setPaths($results->getPaths());
|
||||||
$browse_table->setUser($this->getRequest()->getUser());
|
$browse_table->setUser($request->getUser());
|
||||||
|
|
||||||
$browse_panel = new AphrontPanelView();
|
$browse_panel = new AphrontPanelView();
|
||||||
$browse_panel->appendChild($browse_table);
|
$browse_panel->appendChild($browse_table);
|
||||||
|
|
|
@ -6,8 +6,7 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
|
||||||
private $lintMessages;
|
private $lintMessages;
|
||||||
private $coverage;
|
private $coverage;
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
final class DiffusionBrowseMainController extends DiffusionBrowseController {
|
final class DiffusionBrowseMainController extends DiffusionBrowseController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
// Figure out if we're browsing a directory, a file, or a search result
|
// Figure out if we're browsing a directory, a file, or a search result
|
||||||
// list. Then delegate to the appropriate controller.
|
// list. Then delegate to the appropriate controller.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
final class DiffusionBrowseSearchController extends DiffusionBrowseController {
|
final class DiffusionBrowseSearchController extends DiffusionBrowseController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
|
|
||||||
$actions = $this->buildActionView($drequest);
|
$actions = $this->buildActionView($drequest);
|
||||||
|
|
|
@ -6,9 +6,9 @@ final class DiffusionChangeController extends DiffusionController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$viewer = $this->getRequest()->getUser();
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
$content = array();
|
$content = array();
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ final class DiffusionChangeController extends DiffusionController {
|
||||||
$changeset_view->setRenderURI('/diffusion/'.$callsign.'/diff/');
|
$changeset_view->setRenderURI('/diffusion/'.$callsign.'/diff/');
|
||||||
$changeset_view->setWhitespace(
|
$changeset_view->setWhitespace(
|
||||||
DifferentialChangesetParser::WHITESPACE_SHOW_ALL);
|
DifferentialChangesetParser::WHITESPACE_SHOW_ALL);
|
||||||
$changeset_view->setUser($this->getRequest()->getUser());
|
$changeset_view->setUser($viewer);
|
||||||
|
|
||||||
// TODO: This is pretty awkward, unify the CSS between Diffusion and
|
// TODO: This is pretty awkward, unify the CSS between Diffusion and
|
||||||
// Differential better.
|
// Differential better.
|
||||||
|
|
|
@ -6,20 +6,15 @@ final class DiffusionCommitBranchesController extends DiffusionController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$data['user'] = $this->getRequest()->getUser();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$this->diffusionRequest = DiffusionRequest::newFromDictionary($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getDiffusionRequest();
|
|
||||||
|
|
||||||
$branches = array();
|
$branches = array();
|
||||||
try {
|
try {
|
||||||
$branches = $this->callConduitWithDiffusionRequest(
|
$branches = $this->callConduitWithDiffusionRequest(
|
||||||
'diffusion.branchquery',
|
'diffusion.branchquery',
|
||||||
array(
|
array(
|
||||||
'contains' => $request->getCommit(),
|
'contains' => $drequest->getCommit(),
|
||||||
));
|
));
|
||||||
} catch (ConduitException $ex) {
|
} catch (ConduitException $ex) {
|
||||||
if ($ex->getMessage() != 'ERR-UNSUPPORTED-VCS') {
|
if ($ex->getMessage() != 'ERR-UNSUPPORTED-VCS') {
|
||||||
|
@ -34,7 +29,7 @@ final class DiffusionCommitBranchesController extends DiffusionController {
|
||||||
$branch_links[] = phutil_tag(
|
$branch_links[] = phutil_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
'href' => $request->generateURI(
|
'href' => $drequest->generateURI(
|
||||||
array(
|
array(
|
||||||
'action' => 'browse',
|
'action' => 'browse',
|
||||||
'branch' => $branch->getShortName(),
|
'branch' => $branch->getShortName(),
|
||||||
|
|
|
@ -11,19 +11,18 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function shouldLoadDiffusionRequest() {
|
||||||
// This controller doesn't use blob/path stuff, just pass the dictionary
|
return false;
|
||||||
// in directly instead of using the AphrontRequest parsing mechanism.
|
|
||||||
$data['user'] = $this->getRequest()->getUser();
|
|
||||||
$drequest = DiffusionRequest::newFromDictionary($data);
|
|
||||||
$this->diffusionRequest = $drequest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$drequest = $this->getDiffusionRequest();
|
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
|
// This controller doesn't use blob/path stuff, just pass the dictionary
|
||||||
|
// in directly instead of using the AphrontRequest parsing mechanism.
|
||||||
|
$data = $request->getURIMap();
|
||||||
|
$data['user'] = $user;
|
||||||
|
$drequest = DiffusionRequest::newFromDictionary($data);
|
||||||
|
$this->diffusionRequest = $drequest;
|
||||||
|
|
||||||
if ($request->getStr('diff')) {
|
if ($request->getStr('diff')) {
|
||||||
return $this->buildRawDiffResponse($drequest);
|
return $this->buildRawDiffResponse($drequest);
|
||||||
|
|
|
@ -2,13 +2,7 @@
|
||||||
|
|
||||||
final class DiffusionCommitEditController extends DiffusionController {
|
final class DiffusionCommitEditController extends DiffusionController {
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$data['user'] = $this->getRequest()->getUser();
|
|
||||||
$this->diffusionRequest = DiffusionRequest::newFromDictionary($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$callsign = $drequest->getRepository()->getCallsign();
|
$callsign = $drequest->getRepository()->getCallsign();
|
||||||
|
|
|
@ -6,13 +6,8 @@ final class DiffusionCommitTagsController extends DiffusionController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$data['user'] = $this->getRequest()->getUser();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$this->diffusionRequest = DiffusionRequest::newFromDictionary($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getDiffusionRequest();
|
|
||||||
$tag_limit = 10;
|
$tag_limit = 10;
|
||||||
|
|
||||||
$tags = array();
|
$tags = array();
|
||||||
|
@ -21,7 +16,7 @@ final class DiffusionCommitTagsController extends DiffusionController {
|
||||||
$this->callConduitWithDiffusionRequest(
|
$this->callConduitWithDiffusionRequest(
|
||||||
'diffusion.tagsquery',
|
'diffusion.tagsquery',
|
||||||
array(
|
array(
|
||||||
'commit' => $request->getCommit(),
|
'commit' => $drequest->getCommit(),
|
||||||
'limit' => $tag_limit + 1,
|
'limit' => $tag_limit + 1,
|
||||||
)));
|
)));
|
||||||
} catch (ConduitException $ex) {
|
} catch (ConduitException $ex) {
|
||||||
|
@ -38,7 +33,7 @@ final class DiffusionCommitTagsController extends DiffusionController {
|
||||||
$tag_links[] = phutil_tag(
|
$tag_links[] = phutil_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
'href' => $request->generateURI(
|
'href' => $drequest->generateURI(
|
||||||
array(
|
array(
|
||||||
'action' => 'browse',
|
'action' => 'browse',
|
||||||
'commit' => $tag->getName(),
|
'commit' => $tag->getName(),
|
||||||
|
@ -51,7 +46,7 @@ final class DiffusionCommitTagsController extends DiffusionController {
|
||||||
$tag_links[] = phutil_tag(
|
$tag_links[] = phutil_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
'href' => $request->generateURI(
|
'href' => $drequest->generateURI(
|
||||||
array(
|
array(
|
||||||
'action' => 'tags',
|
'action' => 'tags',
|
||||||
)),
|
)),
|
||||||
|
|
|
@ -31,15 +31,28 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
return parent::willBeginExecution();
|
return parent::willBeginExecution();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function shouldLoadDiffusionRequest() {
|
||||||
if (isset($data['callsign'])) {
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
final public function handleRequest(AphrontRequest $request) {
|
||||||
|
if ($request->getURIData('callsign') &&
|
||||||
|
$this->shouldLoadDiffusionRequest()) {
|
||||||
|
try {
|
||||||
$drequest = DiffusionRequest::newFromAphrontRequestDictionary(
|
$drequest = DiffusionRequest::newFromAphrontRequestDictionary(
|
||||||
$data,
|
$request->getURIMap(),
|
||||||
$this->getRequest());
|
$request);
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
return id(new Aphront404Response())
|
||||||
|
->setRequest($request);
|
||||||
|
}
|
||||||
$this->setDiffusionRequest($drequest);
|
$this->setDiffusionRequest($drequest);
|
||||||
}
|
}
|
||||||
|
return $this->processDiffusionRequest($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract protected function processDiffusionRequest(AphrontRequest $request);
|
||||||
|
|
||||||
public function buildCrumbs(array $spec = array()) {
|
public function buildCrumbs(array $spec = array()) {
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
$crumb_list = $this->buildCrumbList($spec);
|
$crumb_list = $this->buildCrumbList($spec);
|
||||||
|
|
|
@ -6,20 +6,26 @@ final class DiffusionDiffController extends DiffusionController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function shouldLoadDiffusionRequest() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
|
$data = $request->getURIMap();
|
||||||
$data = $data + array(
|
$data = $data + array(
|
||||||
'dblob' => $this->getRequest()->getStr('ref'),
|
'dblob' => $this->getRequest()->getStr('ref'),
|
||||||
);
|
);
|
||||||
$drequest = DiffusionRequest::newFromAphrontRequestDictionary(
|
try {
|
||||||
$data,
|
$drequest = DiffusionRequest::newFromAphrontRequestDictionary(
|
||||||
$this->getRequest());
|
$data,
|
||||||
|
$request);
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
return id(new Aphront404Response())
|
||||||
|
->setRequest($request);
|
||||||
|
}
|
||||||
|
$this->setDiffusionRequest($drequest);
|
||||||
|
|
||||||
$this->diffusionRequest = $drequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
|
|
||||||
if (!$request->isAjax()) {
|
if (!$request->isAjax()) {
|
||||||
|
|
|
@ -2,16 +2,15 @@
|
||||||
|
|
||||||
final class DiffusionExternalController extends DiffusionController {
|
final class DiffusionExternalController extends DiffusionController {
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
|
||||||
// Don't build a DiffusionRequest.
|
|
||||||
}
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function shouldLoadDiffusionRequest() {
|
||||||
$request = $this->getRequest();
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
|
|
||||||
$uri = $request->getStr('uri');
|
$uri = $request->getStr('uri');
|
||||||
$id = $request->getStr('id');
|
$id = $request->getStr('id');
|
||||||
|
|
|
@ -6,9 +6,8 @@ final class DiffusionHistoryController extends DiffusionController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,8 @@ final class DiffusionLastModifiedController extends DiffusionController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
$paths = $request->getStr('paths');
|
$paths = $request->getStr('paths');
|
||||||
|
|
|
@ -6,9 +6,8 @@ final class DiffusionLintController extends DiffusionController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
$user = $request->getUser();
|
||||||
$user = $this->getRequest()->getUser();
|
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
|
|
||||||
if ($request->getStr('lint') !== null) {
|
if ($request->getStr('lint') !== null) {
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
final class DiffusionLintDetailsController extends DiffusionController {
|
final class DiffusionLintDetailsController extends DiffusionController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$limit = 500;
|
$limit = 500;
|
||||||
$offset = $this->getRequest()->getInt('offset', 0);
|
$offset = $request->getInt('offset', 0);
|
||||||
|
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$branch = $drequest->loadBranch();
|
$branch = $drequest->loadBranch();
|
||||||
|
@ -70,7 +70,7 @@ final class DiffusionLintDetailsController extends DiffusionController {
|
||||||
->setPageSize($limit)
|
->setPageSize($limit)
|
||||||
->setOffset($offset)
|
->setOffset($offset)
|
||||||
->setHasMorePages(count($messages) >= $limit)
|
->setHasMorePages(count($messages) >= $limit)
|
||||||
->setURI($this->getRequest()->getRequestURI(), 'offset');
|
->setURI($request->getRequestURI(), 'offset');
|
||||||
|
|
||||||
$content[] = id(new AphrontPanelView())
|
$content[] = id(new AphrontPanelView())
|
||||||
->setNoBackground(true)
|
->setNoBackground(true)
|
||||||
|
|
|
@ -3,22 +3,14 @@
|
||||||
final class DiffusionMirrorDeleteController
|
final class DiffusionMirrorDeleteController
|
||||||
extends DiffusionController {
|
extends DiffusionController {
|
||||||
|
|
||||||
private $id;
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
|
||||||
$this->id = $data['id'];
|
|
||||||
parent::willProcessRequest($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
||||||
$mirror = id(new PhabricatorRepositoryMirrorQuery())
|
$mirror = id(new PhabricatorRepositoryMirrorQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($request->getURIData('id')))
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
PhabricatorPolicyCapability::CAN_VIEW,
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
|
|
@ -3,15 +3,7 @@
|
||||||
final class DiffusionMirrorEditController
|
final class DiffusionMirrorEditController
|
||||||
extends DiffusionController {
|
extends DiffusionController {
|
||||||
|
|
||||||
private $id;
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
|
||||||
$this->id = idx($data, 'id');
|
|
||||||
parent::willProcessRequest($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
@ -21,10 +13,10 @@ final class DiffusionMirrorEditController
|
||||||
$repository,
|
$repository,
|
||||||
PhabricatorPolicyCapability::CAN_EDIT);
|
PhabricatorPolicyCapability::CAN_EDIT);
|
||||||
|
|
||||||
if ($this->id) {
|
if ($request->getURIData('id')) {
|
||||||
$mirror = id(new PhabricatorRepositoryMirrorQuery())
|
$mirror = id(new PhabricatorRepositoryMirrorQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($request->getURIData('id')))
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
PhabricatorPolicyCapability::CAN_VIEW,
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
|
|
||||||
final class DiffusionPathCompleteController extends DiffusionController {
|
final class DiffusionPathCompleteController extends DiffusionController {
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function shouldLoadDiffusionRequest() {
|
||||||
// Don't build a DiffusionRequest.
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
$repository_phid = $request->getStr('repositoryPHID');
|
$repository_phid = $request->getStr('repositoryPHID');
|
||||||
$repository = id(new PhabricatorRepositoryQuery())
|
$repository = id(new PhabricatorRepositoryQuery())
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
final class DiffusionPathTreeController extends DiffusionController {
|
final class DiffusionPathTreeController extends DiffusionController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
|
|
||||||
if (!$drequest->getRepository()->canUsePathTree()) {
|
if (!$drequest->getRepository()->canUsePathTree()) {
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
|
|
||||||
final class DiffusionPathValidateController extends DiffusionController {
|
final class DiffusionPathValidateController extends DiffusionController {
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function shouldLoadDiffusionRequest() {
|
||||||
// Don't build a DiffusionRequest.
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
$repository_phid = $request->getStr('repositoryPHID');
|
$repository_phid = $request->getStr('repositoryPHID');
|
||||||
$repository = id(new PhabricatorRepositoryQuery())
|
$repository = id(new PhabricatorRepositoryQuery())
|
||||||
|
|
|
@ -3,23 +3,16 @@
|
||||||
final class DiffusionPushEventViewController
|
final class DiffusionPushEventViewController
|
||||||
extends DiffusionPushLogController {
|
extends DiffusionPushLogController {
|
||||||
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$this->id = idx($data, 'id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
$event = id(new PhabricatorRepositoryPushEventQuery())
|
$event = id(new PhabricatorRepositoryPushEventQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($request->getURIData('id')))
|
||||||
->needLogs(true)
|
->needLogs(true)
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$event) {
|
if (!$event) {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
abstract class DiffusionPushLogController extends DiffusionController {}
|
abstract class DiffusionPushLogController extends DiffusionController {
|
||||||
|
|
||||||
|
protected function shouldLoadDiffusionRequest() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -2,20 +2,14 @@
|
||||||
|
|
||||||
final class DiffusionPushLogListController extends DiffusionPushLogController {
|
final class DiffusionPushLogListController extends DiffusionPushLogController {
|
||||||
|
|
||||||
private $queryKey;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
$controller = id(new PhabricatorApplicationSearchController())
|
||||||
->setQueryKey($this->queryKey)
|
->setQueryKey($request->getURIData('queryKey'))
|
||||||
->setSearchEngine(new PhabricatorRepositoryPushLogSearchEngine())
|
->setSearchEngine(new PhabricatorRepositoryPushLogSearchEngine())
|
||||||
->setNavigation($this->buildSideNavView());
|
->setNavigation($this->buildSideNavView());
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ final class DiffusionRepositoryController extends DiffusionController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
|
|
|
@ -6,14 +6,9 @@ final class DiffusionRepositoryCreateController
|
||||||
private $edit;
|
private $edit;
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
parent::willProcessRequest($data);
|
|
||||||
$this->edit = $data['edit'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
|
$this->edit = $request->getURIData('edit');
|
||||||
|
|
||||||
// NOTE: We can end up here via either "Create Repository", or via
|
// NOTE: We can end up here via either "Create Repository", or via
|
||||||
// "Import Repository", or via "Edit Remote", or via "Edit Policies". In
|
// "Import Repository", or via "Edit Remote", or via "Edit Policies". In
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
final class DiffusionRepositoryDefaultController extends DiffusionController {
|
final class DiffusionRepositoryDefaultController extends DiffusionController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
// NOTE: This controller is just here to make sure we call
|
// NOTE: This controller is just here to make sure we call
|
||||||
// willBeginExecution() on any /diffusion/X/ URI, so we can intercept
|
// willBeginExecution() on any /diffusion/X/ URI, so we can intercept
|
||||||
// `git`, `hg` and `svn` HTTP protocol requests.
|
// `git`, `hg` and `svn` HTTP protocol requests.
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
final class DiffusionRepositoryEditActionsController
|
final class DiffusionRepositoryEditActionsController
|
||||||
extends DiffusionRepositoryEditController {
|
extends DiffusionRepositoryEditController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
final class DiffusionRepositoryEditActivateController
|
final class DiffusionRepositoryEditActivateController
|
||||||
extends DiffusionRepositoryEditController {
|
extends DiffusionRepositoryEditController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
final class DiffusionRepositoryEditBasicController
|
final class DiffusionRepositoryEditBasicController
|
||||||
extends DiffusionRepositoryEditController {
|
extends DiffusionRepositoryEditController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
final class DiffusionRepositoryEditBranchesController
|
final class DiffusionRepositoryEditBranchesController
|
||||||
extends DiffusionRepositoryEditController {
|
extends DiffusionRepositoryEditController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
final class DiffusionRepositoryEditDangerousController
|
final class DiffusionRepositoryEditDangerousController
|
||||||
extends DiffusionRepositoryEditController {
|
extends DiffusionRepositoryEditController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
final class DiffusionRepositoryEditDeleteController
|
final class DiffusionRepositoryEditDeleteController
|
||||||
extends DiffusionRepositoryEditController {
|
extends DiffusionRepositoryEditController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
final class DiffusionRepositoryEditEncodingController
|
final class DiffusionRepositoryEditEncodingController
|
||||||
extends DiffusionRepositoryEditController {
|
extends DiffusionRepositoryEditController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
|
@ -5,16 +5,11 @@ final class DiffusionRepositoryEditHostingController
|
||||||
|
|
||||||
private $serve;
|
private $serve;
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
parent::willProcessRequest($data);
|
|
||||||
$this->serve = idx($data, 'serve');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
$this->serve = $request->getURIData('serve');
|
||||||
|
|
||||||
$repository = id(new PhabricatorRepositoryQuery())
|
$repository = id(new PhabricatorRepositoryQuery())
|
||||||
->setViewer($user)
|
->setViewer($user)
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
final class DiffusionRepositoryEditMainController
|
final class DiffusionRepositoryEditMainController
|
||||||
extends DiffusionRepositoryEditController {
|
extends DiffusionRepositoryEditController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
final class DiffusionRepositoryEditStorageController
|
final class DiffusionRepositoryEditStorageController
|
||||||
extends DiffusionRepositoryEditController {
|
extends DiffusionRepositoryEditController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
final class DiffusionRepositoryEditSubversionController
|
final class DiffusionRepositoryEditSubversionController
|
||||||
extends DiffusionRepositoryEditController {
|
extends DiffusionRepositoryEditController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
final class DiffusionRepositoryEditUpdateController
|
final class DiffusionRepositoryEditUpdateController
|
||||||
extends DiffusionRepositoryEditController {
|
extends DiffusionRepositoryEditController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
|
@ -2,20 +2,13 @@
|
||||||
|
|
||||||
final class DiffusionRepositoryListController extends DiffusionController {
|
final class DiffusionRepositoryListController extends DiffusionController {
|
||||||
|
|
||||||
private $queryKey;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
$controller = id(new PhabricatorApplicationSearchController())
|
||||||
->setQueryKey($this->queryKey)
|
->setQueryKey($request->getURIData('queryKey'))
|
||||||
->setSearchEngine(new PhabricatorRepositorySearchEngine())
|
->setSearchEngine(new PhabricatorRepositorySearchEngine())
|
||||||
->setNavigation($this->buildSideNavView());
|
->setNavigation($this->buildSideNavView());
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
final class DiffusionRepositoryNewController extends DiffusionController {
|
final class DiffusionRepositoryNewController extends DiffusionController {
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
$this->requireApplicationCapability(
|
$this->requireApplicationCapability(
|
||||||
|
|
|
@ -55,8 +55,7 @@ final class DiffusionServeController extends DiffusionController {
|
||||||
return $matches['callsign'];
|
return $matches['callsign'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
$callsign = self::getCallsign($request);
|
$callsign = self::getCallsign($request);
|
||||||
|
|
||||||
// If authentication credentials have been provided, try to find a user
|
// If authentication credentials have been provided, try to find a user
|
||||||
|
|
|
@ -4,13 +4,9 @@ final class DiffusionSymbolController extends DiffusionController {
|
||||||
|
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$this->name = $data['name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
|
$this->name = $request->getURIData('name');
|
||||||
|
|
||||||
$query = new DiffusionSymbolQuery();
|
$query = new DiffusionSymbolQuery();
|
||||||
$query->setName($this->name);
|
$query->setName($this->name);
|
||||||
|
|
|
@ -6,9 +6,8 @@ final class DiffusionTagListController extends DiffusionController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
Loading…
Reference in a new issue