diff --git a/src/applications/people/controller/PhabricatorPeopleController.php b/src/applications/people/controller/PhabricatorPeopleController.php index b4e7e4a8df..d51dc4ceec 100644 --- a/src/applications/people/controller/PhabricatorPeopleController.php +++ b/src/applications/people/controller/PhabricatorPeopleController.php @@ -6,39 +6,33 @@ abstract class PhabricatorPeopleController extends PhabricatorController { return true; } + /** + * return AphrontSideNavFilterView + */ public function buildSideNavView($for_app = false) { + // we are on /people/* $nav = new AphrontSideNavFilterView(); $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); - $name = null; - if ($for_app) { - $name = $this->getRequest()->getURIData('username'); - if ($name) { - $nav->setBaseURI(new PhutilURI('/p/')); - $nav->addFilter("{$name}/", $name); - if (id(new PhabricatorCalendarApplication())->isInstalled()) { - $nav->addFilter("{$name}/calendar/", pht('Calendar')); - } - } - } + $viewer = $this->getRequest()->getUser(); + id(new PhabricatorPeopleSearchEngine()) + ->setViewer($viewer) + ->addNavigationItems($nav->getMenu()); - if (!$name) { - $viewer = $this->getRequest()->getUser(); - id(new PhabricatorPeopleSearchEngine()) - ->setViewer($viewer) - ->addNavigationItems($nav->getMenu()); - - if ($viewer->getIsAdmin()) { - $nav->addLabel(pht('User Administration')); - $nav->addFilter('logs', pht('Activity Logs')); - $nav->addFilter('invite', pht('Email Invitations')); - } + if ($viewer->getIsAdmin()) { + $nav->addLabel(pht('User Administration')); + $nav->addFilter('logs', pht('Activity Logs')); + $nav->addFilter('invite', pht('Email Invitations')); } return $nav; } public function buildApplicationMenu() { + if ($this->getRequest()->getURIData('username')) { + // we are on /p/name/ so return the default user profile sidebar + return parent::buildApplicationMenu(); + } return $this->buildSideNavView(true)->getMenu(); } diff --git a/src/applications/search/engine/PhabricatorProfileMenuEngine.php b/src/applications/search/engine/PhabricatorProfileMenuEngine.php index 8799ae8f0b..bfa3d11ee5 100644 --- a/src/applications/search/engine/PhabricatorProfileMenuEngine.php +++ b/src/applications/search/engine/PhabricatorProfileMenuEngine.php @@ -87,6 +87,9 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { abstract public function getItemURI($path); abstract protected function isMenuEngineConfigurable(); + /** + * @return array of PhabricatorProfileMenuItemConfiguration objects + */ abstract protected function getBuiltinProfileItems($object); protected function getBuiltinCustomProfileItems(