Page MenuHomePhabricator

D15113.id36492.diff
No OneTemporary

D15113.id36492.diff

diff --git a/src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php b/src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php
--- a/src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php
+++ b/src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php
@@ -13,6 +13,11 @@
return pht('Manage');
}
+ public function canHidePanel(
+ PhabricatorProfilePanelConfiguration $config) {
+ return false;
+ }
+
public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) {
$name = $config->getPanelProperty('name');
diff --git a/src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php
--- a/src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php
+++ b/src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php
@@ -13,6 +13,11 @@
return pht('Manage');
}
+ public function canHidePanel(
+ PhabricatorProfilePanelConfiguration $config) {
+ return false;
+ }
+
public function canMakeDefault(
PhabricatorProfilePanelConfiguration $config) {
return true;
diff --git a/src/applications/search/engine/PhabricatorProfilePanelEngine.php b/src/applications/search/engine/PhabricatorProfilePanelEngine.php
--- a/src/applications/search/engine/PhabricatorProfilePanelEngine.php
+++ b/src/applications/search/engine/PhabricatorProfilePanelEngine.php
@@ -600,10 +600,13 @@
$hide_text = pht('Delete');
}
+ $can_disable = $panel->canHidePanel();
+
$item->addAction(
id(new PHUIListItemView())
->setHref($hide_uri)
->setWorkflow(true)
+ ->setDisabled(!$can_disable)
->setName($hide_text)
->setIcon($hide_icon));
}
@@ -761,6 +764,14 @@
$configuration,
PhabricatorPolicyCapability::CAN_EDIT);
+ if (!$configuration->canHidePanel()) {
+ return $controller->newDialog()
+ ->setTitle(pht('Mandatory Panel'))
+ ->appendParagraph(
+ pht('This panel is very important, and can not be disabled.'))
+ ->addCancelButton($this->getConfigureURI());
+ }
+
if ($configuration->getBuiltinKey() === null) {
$new_value = null;
diff --git a/src/applications/search/profilepanel/PhabricatorProfilePanel.php b/src/applications/search/profilepanel/PhabricatorProfilePanel.php
--- a/src/applications/search/profilepanel/PhabricatorProfilePanel.php
+++ b/src/applications/search/profilepanel/PhabricatorProfilePanel.php
@@ -30,6 +30,11 @@
return false;
}
+ public function canHidePanel(
+ PhabricatorProfilePanelConfiguration $config) {
+ return true;
+ }
+
public function canMakeDefault(
PhabricatorProfilePanelConfiguration $config) {
return false;
diff --git a/src/applications/search/storage/PhabricatorProfilePanelConfiguration.php b/src/applications/search/storage/PhabricatorProfilePanelConfiguration.php
--- a/src/applications/search/storage/PhabricatorProfilePanelConfiguration.php
+++ b/src/applications/search/storage/PhabricatorProfilePanelConfiguration.php
@@ -105,6 +105,10 @@
return $this->getPanel()->canMakeDefault($this);
}
+ public function canHidePanel() {
+ return $this->getPanel()->canHidePanel($this);
+ }
+
public function getSortKey() {
$order = $this->getPanelOrder();
if ($order === null) {
@@ -120,6 +124,9 @@
}
public function isDisabled() {
+ if (!$this->canHidePanel()) {
+ return false;
+ }
return ($this->getVisibility() === self::VISIBILITY_DISABLED);
}
diff --git a/src/docs/user/userguide/profile_menu.diviner b/src/docs/user/userguide/profile_menu.diviner
--- a/src/docs/user/userguide/profile_menu.diviner
+++ b/src/docs/user/userguide/profile_menu.diviner
@@ -40,9 +40,10 @@
must have permission to edit a project in order to reconfigure the menu for the
project.
-To edit a menu, click {nav icon="pencil", name="Edit Menu"}. This brings you to
-the menu configuration interface which allows you to add and remove items,
-reorder the menu, edit existing items, and choose a default item.
+To edit a menu, click {nav icon="cogs", name="Manage"} in the menu, then click
+{nav icon="th-list", name="Edit Menu"}. This brings you to the menu
+configuration interface which allows you to add and remove items, reorder the
+menu, edit existing items, and choose a default item.
Menus are comprised of a list of items. Some of the items are builtin
(for example, projects have builtin "Profile", "Workboard" and "Members"
@@ -95,6 +96,11 @@
not delete them. You an re-enable a disabled item with the
{nav icon="plus', name="Enable"} action.
+A few items can not be hidden or deleted. For example, the
+{nav icon="cogs", name="Manage"} item must always be available in the menu
+because if you hid it by accident there would no longer be a way to access
+the configuration interface and fix the mistake.
+
Removing or hiding an item does not disable the underlying functionality.
For example, if you hide the "Members" item for a project, that just removes
it from the menu. The project still has members, and users can still navigate

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 21, 9:25 AM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7390189
Default Alt Text
D15113.id36492.diff (5 KB)

Event Timeline