1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-02 09:58:24 +01:00

Fix a fatal when navigating to a Workboard after removing the Workboard menu item

Summary:
See PHI1247. If you remove the Workboard from a project profile menu, then navigate to the URI, we currently fatal when trying to select the "Workboard" item.

Instead, only try to select the item if some matching item is present.

Test Plan:
  - Disabled the workboard on a project, navigated to `/board/`, got a sensible page with no navigation item selected instead of a fatal.
  - Viewed a normal workboard, saw the correct selection.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20516
This commit is contained in:
epriestley 2019-05-13 07:15:23 -07:00
parent 1d58f14469
commit ee89c2fad9

View file

@ -191,7 +191,13 @@ abstract class PhabricatorProjectController extends PhabricatorController {
$view_list = $engine->newProfileMenuItemViewList();
$view_list->setSelectedViewWithItemIdentifier($item_identifier);
// See PHI1247. If the "Workboard" item is removed from the menu, we will
// not be able to select it. This can happen if a user removes the item,
// then manually navigate to the workboard URI (or follows an older link).
// In this case, just render the menu with no selected item.
if ($view_list->getViewsWithItemIdentifier($item_identifier)) {
$view_list->setSelectedViewWithItemIdentifier($item_identifier);
}
$navigation = $view_list->newNavigationView();