From a19859053300f7087615f305f0ec8cb2038f7d4c Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 23 Jun 2017 12:06:04 -0700 Subject: [PATCH] Degrade more gracefully when ProfileMenu dashboards fail to render Summary: Ref T12871. This replaces a dead end UI (user totally locked out) with one where the menu is still available, if the default menu item is one which generates a policy exception (e.g., because users can't see the dashboard). Really, we should do better than this and not select this item as the default item if the viewer can't see it, but there is currently no reliable way to test for "can the viewer see this item?" so this is a more involved change. I'm thinking we get this minor improvement into the release, then pursue a more detailed fix afterward. Test Plan: - Added a dashboard as the top item in the global menu. - Changed the dashboard to be visible to only user B. - Viewed Home as user A. - Before patch: entire page is a policy exception dialog. - After patch, things are better: {F5014179} Reviewers: chad, amckinley Reviewed By: amckinley Maniphest Tasks: T12871 Differential Revision: https://secure.phabricator.com/D18152 --- .../search/engine/PhabricatorProfileMenuEngine.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/applications/search/engine/PhabricatorProfileMenuEngine.php b/src/applications/search/engine/PhabricatorProfileMenuEngine.php index 4b24e67c6b..7b1e213d20 100644 --- a/src/applications/search/engine/PhabricatorProfileMenuEngine.php +++ b/src/applications/search/engine/PhabricatorProfileMenuEngine.php @@ -238,7 +238,14 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { case 'view': $navigation->selectFilter($selected_item->getDefaultMenuItemKey()); - $content = $this->buildItemViewContent($selected_item); + try { + $content = $this->buildItemViewContent($selected_item); + } catch (Exception $ex) { + $content = id(new PHUIInfoView()) + ->setTitle(pht('Unable to Render Dashboard')) + ->setErrors(array($ex->getMessage())); + } + $crumbs->addTextCrumb($selected_item->getDisplayName()); if (!$content) { return new Aphront404Response();