@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.

Prevent "Manage" profile menu items from being hidden

Summary: Ref T10054. Prevent users from removing this item and locking themselves out of the system unless they can guess the URI.

Test Plan: Tried to disable "Manage", wasn't permitted to.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10054

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

+42 -3
+5
src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php
··· 13 13 return pht('Manage'); 14 14 } 15 15 16 + public function canHidePanel( 17 + PhabricatorProfilePanelConfiguration $config) { 18 + return false; 19 + } 20 + 16 21 public function getDisplayName( 17 22 PhabricatorProfilePanelConfiguration $config) { 18 23 $name = $config->getPanelProperty('name');
+5
src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php
··· 13 13 return pht('Manage'); 14 14 } 15 15 16 + public function canHidePanel( 17 + PhabricatorProfilePanelConfiguration $config) { 18 + return false; 19 + } 20 + 16 21 public function canMakeDefault( 17 22 PhabricatorProfilePanelConfiguration $config) { 18 23 return true;
+11
src/applications/search/engine/PhabricatorProfilePanelEngine.php
··· 600 600 $hide_text = pht('Delete'); 601 601 } 602 602 603 + $can_disable = $panel->canHidePanel(); 604 + 603 605 $item->addAction( 604 606 id(new PHUIListItemView()) 605 607 ->setHref($hide_uri) 606 608 ->setWorkflow(true) 609 + ->setDisabled(!$can_disable) 607 610 ->setName($hide_text) 608 611 ->setIcon($hide_icon)); 609 612 } ··· 760 763 $viewer, 761 764 $configuration, 762 765 PhabricatorPolicyCapability::CAN_EDIT); 766 + 767 + if (!$configuration->canHidePanel()) { 768 + return $controller->newDialog() 769 + ->setTitle(pht('Mandatory Panel')) 770 + ->appendParagraph( 771 + pht('This panel is very important, and can not be disabled.')) 772 + ->addCancelButton($this->getConfigureURI()); 773 + } 763 774 764 775 if ($configuration->getBuiltinKey() === null) { 765 776 $new_value = null;
+5
src/applications/search/profilepanel/PhabricatorProfilePanel.php
··· 30 30 return false; 31 31 } 32 32 33 + public function canHidePanel( 34 + PhabricatorProfilePanelConfiguration $config) { 35 + return true; 36 + } 37 + 33 38 public function canMakeDefault( 34 39 PhabricatorProfilePanelConfiguration $config) { 35 40 return false;
+7
src/applications/search/storage/PhabricatorProfilePanelConfiguration.php
··· 105 105 return $this->getPanel()->canMakeDefault($this); 106 106 } 107 107 108 + public function canHidePanel() { 109 + return $this->getPanel()->canHidePanel($this); 110 + } 111 + 108 112 public function getSortKey() { 109 113 $order = $this->getPanelOrder(); 110 114 if ($order === null) { ··· 120 124 } 121 125 122 126 public function isDisabled() { 127 + if (!$this->canHidePanel()) { 128 + return false; 129 + } 123 130 return ($this->getVisibility() === self::VISIBILITY_DISABLED); 124 131 } 125 132
+9 -3
src/docs/user/userguide/profile_menu.diviner
··· 40 40 must have permission to edit a project in order to reconfigure the menu for the 41 41 project. 42 42 43 - To edit a menu, click {nav icon="pencil", name="Edit Menu"}. This brings you to 44 - the menu configuration interface which allows you to add and remove items, 45 - reorder the menu, edit existing items, and choose a default item. 43 + To edit a menu, click {nav icon="cogs", name="Manage"} in the menu, then click 44 + {nav icon="th-list", name="Edit Menu"}. This brings you to the menu 45 + configuration interface which allows you to add and remove items, reorder the 46 + menu, edit existing items, and choose a default item. 46 47 47 48 Menus are comprised of a list of items. Some of the items are builtin 48 49 (for example, projects have builtin "Profile", "Workboard" and "Members" ··· 94 95 {nav icon="times", name="Disable"} action instead, which will hide them but 95 96 not delete them. You an re-enable a disabled item with the 96 97 {nav icon="plus', name="Enable"} action. 98 + 99 + A few items can not be hidden or deleted. For example, the 100 + {nav icon="cogs", name="Manage"} item must always be available in the menu 101 + because if you hid it by accident there would no longer be a way to access 102 + the configuration interface and fix the mistake. 97 103 98 104 Removing or hiding an item does not disable the underlying functionality. 99 105 For example, if you hide the "Members" item for a project, that just removes