diff --git a/src/applications/home/controller/PhabricatorHomeMenuItemController.php b/src/applications/home/controller/PhabricatorHomeMenuItemController.php index f0e436ddd9..39e9faadee 100644 --- a/src/applications/home/controller/PhabricatorHomeMenuItemController.php +++ b/src/applications/home/controller/PhabricatorHomeMenuItemController.php @@ -1,38 +1,32 @@ getViewer(); - if ($viewer->getPHID()) { - $custom_phid = $viewer->getPHID(); - } else { - $custom_phid = null; - } - $application = 'PhabricatorHomeApplication'; $home_app = id(new PhabricatorApplicationQuery()) ->setViewer($viewer) ->withClasses(array($application)) ->withInstalled(true) ->executeOne(); $engine = id(new PhabricatorHomeProfileMenuEngine()) ->setProfileObject($home_app) - ->setCustomPHID($custom_phid) + ->setCustomPHID($viewer->getPHID()) ->setController($this); return $engine->buildResponse(); } } diff --git a/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php b/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php index c4c93f06ff..a727fbced6 100644 --- a/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php +++ b/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php @@ -1,68 +1,66 @@ getMenuItemProperty('name'); if (strlen($name)) { return $name; } return $this->getDefaultName(); } public function buildEditEngineFields( PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorTextEditField()) ->setKey('name') ->setLabel(pht('Name')) ->setPlaceholder($this->getDefaultName()) ->setValue($config->getMenuItemProperty('name')), ); } protected function newNavigationMenuItems( PhabricatorProfileMenuItemConfiguration $config) { $viewer = $this->getViewer(); - if ($viewer->isLoggedIn()) { - $name = $this->getDisplayName($config); - $icon = 'fa-globe'; - $href = '/applications/'; + $name = $this->getDisplayName($config); + $icon = 'fa-globe'; + $href = '/applications/'; - $item = $this->newItem() - ->setHref($href) - ->setName($name) - ->setIcon($icon); - } + $item = $this->newItem() + ->setHref($href) + ->setName($name) + ->setIcon($icon); return array( $item, ); } } diff --git a/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php b/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php index ab77fa9098..40dd2dd41e 100644 --- a/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php +++ b/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php @@ -1,75 +1,77 @@ getMenuItemProperty('name'); if (strlen($name)) { return $name; } return $this->getDefaultName(); } public function newPageContent() { $viewer = $this->getViewer(); return id(new PHUIHomeView()) ->setViewer($viewer); } public function buildEditEngineFields( PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorTextEditField()) ->setKey('name') ->setLabel(pht('Name')) ->setPlaceholder($this->getDefaultName()) ->setValue($config->getMenuItemProperty('name')), ); } protected function newNavigationMenuItems( PhabricatorProfileMenuItemConfiguration $config) { $viewer = $this->getViewer(); - if ($viewer->isLoggedIn()) { - $name = $this->getDisplayName($config); - $icon = 'fa-home'; - $href = $this->getItemViewURI($config); - - $item = $this->newItem() - ->setHref($href) - ->setName($name) - ->setIcon($icon); + if (!$viewer->isLoggedIn()) { + return array(); } + $name = $this->getDisplayName($config); + $icon = 'fa-home'; + $href = $this->getItemViewURI($config); + + $item = $this->newItem() + ->setHref($href) + ->setName($name) + ->setIcon($icon); + return array( $item, ); } }