From a83ba95445e18e9d98d4dd120d38ca713df25fba Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Fri, 7 Jun 2024 18:43:04 +0200 Subject: [PATCH] Only display "Calendar" entry in user profile page menu on mobile when Calendar application is installed Summary: https://we.phorge.it/source/phorge/browse/master/src/view/page/PhabricatorStandardPageView.php$908 tries to "find some navigational menu items to create a mobile navigation menu from" but does not succeed too much it seems: On a user profile page, that very code calls `buildApplicationMenu()` in `PhabricatorPeopleController` which calls `buildSideNavView()` in the same class. This code unconditionally displays a "Calendar" menu item, no matter if the Calendar application is installed or not. Thus check first to avoid offering a link ending up in a 404. For the time being this change renders the menu empty (apart from a link to the page we are already on) but that's more acceptable than all those tears shed by devastated users after clicking the Calendar menu item while being excited and full of anticipation, just to end up on a 404 page instead. Related: T15224 Test Plan: * As an admin, install/uninstall Calendar prototype application via http://phorge.localhost/applications/view/PhabricatorCalendarApplication/ * Go to a user profile page like http://phorge.localhost/username/ on a screen with 920px or less width and click the hamburger menu item in the upper right corner. Check/click the "Calendar" entry. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Differential Revision: https://we.phorge.it/D25683 --- .../people/controller/PhabricatorPeopleController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/applications/people/controller/PhabricatorPeopleController.php b/src/applications/people/controller/PhabricatorPeopleController.php index c2c262f9f4..b4e7e4a8df 100644 --- a/src/applications/people/controller/PhabricatorPeopleController.php +++ b/src/applications/people/controller/PhabricatorPeopleController.php @@ -16,7 +16,9 @@ abstract class PhabricatorPeopleController extends PhabricatorController { if ($name) { $nav->setBaseURI(new PhutilURI('/p/')); $nav->addFilter("{$name}/", $name); - $nav->addFilter("{$name}/calendar/", pht('Calendar')); + if (id(new PhabricatorCalendarApplication())->isInstalled()) { + $nav->addFilter("{$name}/calendar/", pht('Calendar')); + } } }