1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Policy - make sure "quick create" menu doesn't show up if you have nothing you can quick create

Summary: Fixes T7117. The slightly icky part is we just build the menu items up 2x because there's no way to tell you wont be able to make a menu item unless you try to make them all and come up with nada.

Test Plan: created a user and denied them access to every application in the quick create menu. observed the "+" icon disappearing from the nav, correctly. used a different, unrestricted user and the menu showed up and worked

Reviewers: epriestley, chad

Reviewed By: chad

Subscribers: Korvin, epriestley

Maniphest Tasks: T7117

Differential Revision: https://secure.phabricator.com/D11684
This commit is contained in:
Bob Trahan 2015-02-04 14:58:10 -08:00
parent 9b28724210
commit 3639896f5c

View file

@ -46,9 +46,12 @@ final class PhabricatorHomeApplication extends PhabricatorApplication {
PhabricatorUser $user,
PhabricatorController $controller = null) {
$quick_create_items = $this->loadAllQuickCreateItems($user);
$items = array();
if ($user->isLoggedIn() && $user->isUserActivated()) {
if ($user->isLoggedIn() &&
$user->isUserActivated() &&
$quick_create_items) {
$create_id = celerity_generate_unique_node_id();
Javelin::initBehavior(
'aphlict-dropdown',
@ -98,6 +101,8 @@ final class PhabricatorHomeApplication extends PhabricatorApplication {
$items = $this->loadAllQuickCreateItems($viewer);
$view = null;
if ($items) {
$view = new PHUIListView();
$view->newLabel(pht('Create New...'));
foreach ($items as $item) {
@ -113,5 +118,7 @@ final class PhabricatorHomeApplication extends PhabricatorApplication {
),
$view);
}
return $view;
}
}