mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 05:42:40 +01: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:
parent
9b28724210
commit
3639896f5c
1 changed files with 21 additions and 14 deletions
|
@ -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,20 +101,24 @@ final class PhabricatorHomeApplication extends PhabricatorApplication {
|
|||
|
||||
$items = $this->loadAllQuickCreateItems($viewer);
|
||||
|
||||
$view = new PHUIListView();
|
||||
$view->newLabel(pht('Create New...'));
|
||||
foreach ($items as $item) {
|
||||
$view->addMenuItem($item);
|
||||
}
|
||||
$view = null;
|
||||
if ($items) {
|
||||
$view = new PHUIListView();
|
||||
$view->newLabel(pht('Create New...'));
|
||||
foreach ($items as $item) {
|
||||
$view->addMenuItem($item);
|
||||
}
|
||||
|
||||
return phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'id' => 'phabricator-quick-create-menu',
|
||||
'class' => 'phabricator-main-menu-dropdown phui-list-sidenav',
|
||||
'style' => 'display: none',
|
||||
),
|
||||
$view);
|
||||
return phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'id' => 'phabricator-quick-create-menu',
|
||||
'class' => 'phabricator-main-menu-dropdown phui-list-sidenav',
|
||||
'style' => 'display: none',
|
||||
),
|
||||
$view);
|
||||
}
|
||||
return $view;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue