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) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
if ($viewer->getPHID()) {
|
|
||||||
$custom_phid = $viewer->getPHID();
|
|
||||||
} else {
|
|
||||||
$custom_phid = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$application = 'PhabricatorHomeApplication';
|
$application = 'PhabricatorHomeApplication';
|
||||||
$home_app = id(new PhabricatorApplicationQuery())
|
$home_app = id(new PhabricatorApplicationQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
|
@ -29,7 +23,7 @@ final class PhabricatorHomeMenuItemController
|
||||||
|
|
||||||
$engine = id(new PhabricatorHomeProfileMenuEngine())
|
$engine = id(new PhabricatorHomeProfileMenuEngine())
|
||||||
->setProfileObject($home_app)
|
->setProfileObject($home_app)
|
||||||
->setCustomPHID($custom_phid)
|
->setCustomPHID($viewer->getPHID())
|
||||||
->setController($this);
|
->setController($this);
|
||||||
|
|
||||||
return $engine->buildResponse();
|
return $engine->buildResponse();
|
||||||
|
|
|
@ -49,16 +49,14 @@ final class PhabricatorHomeLauncherProfileMenuItem
|
||||||
PhabricatorProfileMenuItemConfiguration $config) {
|
PhabricatorProfileMenuItemConfiguration $config) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
if ($viewer->isLoggedIn()) {
|
$name = $this->getDisplayName($config);
|
||||||
$name = $this->getDisplayName($config);
|
$icon = 'fa-globe';
|
||||||
$icon = 'fa-globe';
|
$href = '/applications/';
|
||||||
$href = '/applications/';
|
|
||||||
|
|
||||||
$item = $this->newItem()
|
$item = $this->newItem()
|
||||||
->setHref($href)
|
->setHref($href)
|
||||||
->setName($name)
|
->setName($name)
|
||||||
->setIcon($icon);
|
->setIcon($icon);
|
||||||
}
|
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
$item,
|
$item,
|
||||||
|
|
|
@ -56,17 +56,19 @@ final class PhabricatorHomeProfileMenuItem
|
||||||
PhabricatorProfileMenuItemConfiguration $config) {
|
PhabricatorProfileMenuItemConfiguration $config) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
if ($viewer->isLoggedIn()) {
|
if (!$viewer->isLoggedIn()) {
|
||||||
$name = $this->getDisplayName($config);
|
return array();
|
||||||
$icon = 'fa-home';
|
|
||||||
$href = $this->getItemViewURI($config);
|
|
||||||
|
|
||||||
$item = $this->newItem()
|
|
||||||
->setHref($href)
|
|
||||||
->setName($name)
|
|
||||||
->setIcon($icon);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$name = $this->getDisplayName($config);
|
||||||
|
$icon = 'fa-home';
|
||||||
|
$href = $this->getItemViewURI($config);
|
||||||
|
|
||||||
|
$item = $this->newItem()
|
||||||
|
->setHref($href)
|
||||||
|
->setName($name)
|
||||||
|
->setIcon($icon);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
$item,
|
$item,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue