Page MenuHomePhabricator

D15200.id.diff
No OneTemporary

D15200.id.diff

diff --git a/src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php
--- a/src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php
+++ b/src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php
@@ -13,6 +13,14 @@
return pht('Subprojects');
}
+ public function shouldEnableForObject($object) {
+ if ($object->isMilestone()) {
+ return false;
+ }
+
+ return true;
+ }
+
public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) {
$name = $config->getPanelProperty('name');
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
@@ -239,6 +239,10 @@
// Merge the stored panels into the builtin panels. If a builtin panel has
// a stored version, replace the defaults with the stored changes.
foreach ($stored_panels as $stored_panel) {
+ if (!$stored_panel->shouldEnableForObject($object)) {
+ continue;
+ }
+
$builtin_key = $stored_panel->getBuiltinKey();
if ($builtin_key !== null) {
// If this builtin actually exists, replace the builtin with the
@@ -341,6 +345,10 @@
->attachProfileObject($object)
->setPanelOrder($order);
+ if (!$builtin->shouldEnableForObject($object)) {
+ continue;
+ }
+
$map[$builtin_key] = $builtin;
$order++;
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,10 @@
return false;
}
+ public function shouldEnableForObject($object) {
+ return true;
+ }
+
public function canHidePanel(
PhabricatorProfilePanelConfiguration $config) {
return true;
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
@@ -109,6 +109,10 @@
return $this->getPanel()->canHidePanel($this);
}
+ public function shouldEnableForObject($object) {
+ return $this->getPanel()->shouldEnableForObject($object);
+ }
+
public function getSortKey() {
$order = $this->getPanelOrder();
if ($order === null) {

File Metadata

Mime Type
text/plain
Expires
Sat, May 11, 4:14 PM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6286431
Default Alt Text
D15200.id.diff (2 KB)

Event Timeline