Summary: Fixes T7507, Create diffusion repo rejection should not navigate away from diffusion. Test Plan: Login as non-admin, open diffusion, attempt to create new repo, rejection dialog should appear over page instead of navigating to new page. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T7507 Differential Revision: https://secure.phabricator.com/D12557
51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
|
|
final class DiffusionRepositoryListController extends DiffusionController {
|
|
|
|
public function shouldAllowPublic() {
|
|
return true;
|
|
}
|
|
|
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
|
$controller = id(new PhabricatorApplicationSearchController())
|
|
->setQueryKey($request->getURIData('queryKey'))
|
|
->setSearchEngine(new PhabricatorRepositorySearchEngine())
|
|
->setNavigation($this->buildSideNavView());
|
|
|
|
return $this->delegateToController($controller);
|
|
}
|
|
|
|
public function buildSideNavView($for_app = false) {
|
|
$viewer = $this->getRequest()->getUser();
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
id(new PhabricatorRepositorySearchEngine())
|
|
->setViewer($viewer)
|
|
->addNavigationItems($nav->getMenu());
|
|
|
|
$nav->selectFilter(null);
|
|
|
|
return $nav;
|
|
}
|
|
|
|
protected function buildApplicationCrumbs() {
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
$can_create = $this->hasApplicationCapability(
|
|
DiffusionCreateRepositoriesCapability::CAPABILITY);
|
|
|
|
$crumbs->addAction(
|
|
id(new PHUIListItemView())
|
|
->setName(pht('New Repository'))
|
|
->setHref($this->getApplicationURI('new/'))
|
|
->setDisabled(!$can_create)
|
|
->setWorkflow(!$can_create)
|
|
->setIcon('fa-plus-square'));
|
|
|
|
return $crumbs;
|
|
}
|
|
|
|
}
|