mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Fix a couple of home menu issues for logged-out viewers
Summary: Ref T12174. These items could fatal (`$item not defined`) if the viewer was not logged in. Test Plan: - Viewed home as a logged-out user. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12174 Differential Revision: https://secure.phabricator.com/D17274
This commit is contained in:
parent
f23bfccc04
commit
27a33896ff
3 changed files with 19 additions and 25 deletions
|
@ -14,12 +14,6 @@ final class PhabricatorHomeMenuItemController
|
|||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
if ($viewer->getPHID()) {
|
||||
$custom_phid = $viewer->getPHID();
|
||||
} else {
|
||||
$custom_phid = null;
|
||||
}
|
||||
|
||||
$application = 'PhabricatorHomeApplication';
|
||||
$home_app = id(new PhabricatorApplicationQuery())
|
||||
->setViewer($viewer)
|
||||
|
@ -29,7 +23,7 @@ final class PhabricatorHomeMenuItemController
|
|||
|
||||
$engine = id(new PhabricatorHomeProfileMenuEngine())
|
||||
->setProfileObject($home_app)
|
||||
->setCustomPHID($custom_phid)
|
||||
->setCustomPHID($viewer->getPHID())
|
||||
->setController($this);
|
||||
|
||||
return $engine->buildResponse();
|
||||
|
|
|
@ -49,16 +49,14 @@ final class PhabricatorHomeLauncherProfileMenuItem
|
|||
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,
|
||||
|
|
|
@ -56,17 +56,19 @@ final class PhabricatorHomeProfileMenuItem
|
|||
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,
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue