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

Disable "Subprojects" menu item for milestone projects

Summary:
Ref T10010. Milestones can't have subprojects, so this item isn't very useful.

I think there is also an argument for disabling "Members", but that panel is a little less useless and explains the membership rule, so I'm less certain about removing it. I do generally lean toward removing it at some point, though.

Test Plan:
- Viewed a milestone, no "Subprojects" menu item.
- Viewed a normal project, saw item.
- Edited both menus, saw consistent UI.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10010

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

+24
+8
src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php
··· 13 13 return pht('Subprojects'); 14 14 } 15 15 16 + public function shouldEnableForObject($object) { 17 + if ($object->isMilestone()) { 18 + return false; 19 + } 20 + 21 + return true; 22 + } 23 + 16 24 public function getDisplayName( 17 25 PhabricatorProfilePanelConfiguration $config) { 18 26 $name = $config->getPanelProperty('name');
+8
src/applications/search/engine/PhabricatorProfilePanelEngine.php
··· 239 239 // Merge the stored panels into the builtin panels. If a builtin panel has 240 240 // a stored version, replace the defaults with the stored changes. 241 241 foreach ($stored_panels as $stored_panel) { 242 + if (!$stored_panel->shouldEnableForObject($object)) { 243 + continue; 244 + } 245 + 242 246 $builtin_key = $stored_panel->getBuiltinKey(); 243 247 if ($builtin_key !== null) { 244 248 // If this builtin actually exists, replace the builtin with the ··· 340 344 ->attachPanel($panel) 341 345 ->attachProfileObject($object) 342 346 ->setPanelOrder($order); 347 + 348 + if (!$builtin->shouldEnableForObject($object)) { 349 + continue; 350 + } 343 351 344 352 $map[$builtin_key] = $builtin; 345 353
+4
src/applications/search/profilepanel/PhabricatorProfilePanel.php
··· 30 30 return false; 31 31 } 32 32 33 + public function shouldEnableForObject($object) { 34 + return true; 35 + } 36 + 33 37 public function canHidePanel( 34 38 PhabricatorProfilePanelConfiguration $config) { 35 39 return true;
+4
src/applications/search/storage/PhabricatorProfilePanelConfiguration.php
··· 109 109 return $this->getPanel()->canHidePanel($this); 110 110 } 111 111 112 + public function shouldEnableForObject($object) { 113 + return $this->getPanel()->shouldEnableForObject($object); 114 + } 115 + 112 116 public function getSortKey() { 113 117 $order = $this->getPanelOrder(); 114 118 if ($order === null) {