mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-01 01:18:22 +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,
|
PhabricatorUser $user,
|
||||||
PhabricatorController $controller = null) {
|
PhabricatorController $controller = null) {
|
||||||
|
|
||||||
|
$quick_create_items = $this->loadAllQuickCreateItems($user);
|
||||||
$items = array();
|
$items = array();
|
||||||
|
|
||||||
if ($user->isLoggedIn() && $user->isUserActivated()) {
|
if ($user->isLoggedIn() &&
|
||||||
|
$user->isUserActivated() &&
|
||||||
|
$quick_create_items) {
|
||||||
$create_id = celerity_generate_unique_node_id();
|
$create_id = celerity_generate_unique_node_id();
|
||||||
Javelin::initBehavior(
|
Javelin::initBehavior(
|
||||||
'aphlict-dropdown',
|
'aphlict-dropdown',
|
||||||
|
@ -98,20 +101,24 @@ final class PhabricatorHomeApplication extends PhabricatorApplication {
|
||||||
|
|
||||||
$items = $this->loadAllQuickCreateItems($viewer);
|
$items = $this->loadAllQuickCreateItems($viewer);
|
||||||
|
|
||||||
$view = new PHUIListView();
|
$view = null;
|
||||||
$view->newLabel(pht('Create New...'));
|
if ($items) {
|
||||||
foreach ($items as $item) {
|
$view = new PHUIListView();
|
||||||
$view->addMenuItem($item);
|
$view->newLabel(pht('Create New...'));
|
||||||
}
|
foreach ($items as $item) {
|
||||||
|
$view->addMenuItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
return phutil_tag(
|
return phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'id' => 'phabricator-quick-create-menu',
|
'id' => 'phabricator-quick-create-menu',
|
||||||
'class' => 'phabricator-main-menu-dropdown phui-list-sidenav',
|
'class' => 'phabricator-main-menu-dropdown phui-list-sidenav',
|
||||||
'style' => 'display: none',
|
'style' => 'display: none',
|
||||||
),
|
),
|
||||||
$view);
|
$view);
|
||||||
|
}
|
||||||
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue