@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

When Favorites is uninstalled or not visible to the viewer, hide the menu

Summary: Ref T5867. The `executeOne()` currently raises a policy exception if the application isn't visible to the viewer, or we fatal if the application has been uninstalled.

Test Plan:
- Viewed pages with the application uninstalled, saw working pages with no favorites menu.
- Viewed pages with the application restricted, saw working pages with no favorites menu.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T5867

Differential Revision: https://secure.phabricator.com/D17219

+13 -4
+13 -4
src/applications/favorites/application/PhabricatorFavoritesApplication.php
··· 36 36 PhabricatorUser $viewer, 37 37 PhabricatorController $controller = null) { 38 38 39 + $dropdown = $this->renderFavoritesDropdown($viewer); 40 + if (!$dropdown) { 41 + return null; 42 + } 43 + 39 44 return id(new PHUIButtonView()) 40 45 ->setTag('a') 41 46 ->setHref('#') ··· 43 48 ->addClass('phabricator-core-user-menu') 44 49 ->setNoCSS(true) 45 50 ->setDropdown(true) 46 - ->setDropdownMenu($this->renderFavoritesDropdown($viewer)); 51 + ->setDropdownMenu($dropdown); 47 52 } 48 53 49 54 private function renderFavoritesDropdown(PhabricatorUser $viewer) { 55 + $application = __CLASS__; 50 56 51 - $application = __CLASS__; 52 - $favorites = id(new PhabricatorApplicationQuery()) 57 + $applications = id(new PhabricatorApplicationQuery()) 53 58 ->setViewer($viewer) 54 59 ->withClasses(array($application)) 55 60 ->withInstalled(true) 56 - ->executeOne(); 61 + ->execute(); 62 + $favorites = head($applications); 63 + if (!$favorites) { 64 + return null; 65 + } 57 66 58 67 $menu_engine = id(new PhabricatorFavoritesProfileMenuEngine()) 59 68 ->setViewer($viewer)