Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15333451
D17298.id41617.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D17298.id41617.diff
View Options
diff --git a/src/applications/search/engine/PhabricatorProfileMenuEngine.php b/src/applications/search/engine/PhabricatorProfileMenuEngine.php
--- a/src/applications/search/engine/PhabricatorProfileMenuEngine.php
+++ b/src/applications/search/engine/PhabricatorProfileMenuEngine.php
@@ -287,6 +287,9 @@
$content = $this->buildItemHideContent($selected_item);
break;
case 'default':
+ if (!$this->isMenuEnginePinnable()) {
+ return new Aphront404Response();
+ }
$content = $this->buildItemDefaultContent(
$selected_item,
$item_list);
@@ -459,9 +462,13 @@
continue;
}
- if ($item->isDefault()) {
- $default = $item;
- break;
+ // If this engine doesn't support pinning items, don't respect any
+ // setting which might be present in the database.
+ if ($this->isMenuEnginePinnable()) {
+ if ($item->isDefault()) {
+ $default = $item;
+ break;
+ }
}
if ($first === null) {
@@ -709,6 +716,18 @@
return true;
}
+ /**
+ * Does this engine support pinning items?
+ *
+ * Personalizable menus disable pinning by default since it creates a number
+ * of weird edge cases without providing many benefits for current menus.
+ *
+ * @return bool True if items may be pinned as default items.
+ */
+ protected function isMenuEnginePinnable() {
+ return !$this->isMenuEnginePersonalizable();
+ }
+
private function buildMenuEditModeContent() {
$viewer = $this->getViewer();
@@ -833,14 +852,16 @@
$default_uri = $this->getItemURI("default/{$builtin_key}/");
}
- if ($item->isDefault()) {
- $default_icon = 'fa-thumb-tack green';
- $default_text = pht('Current Default');
- } else if ($item->canMakeDefault()) {
- $default_icon = 'fa-thumb-tack';
- $default_text = pht('Make Default');
- } else {
- $default_text = null;
+ $default_text = null;
+
+ if ($this->isMenuEnginePinnable()) {
+ if ($item->isDefault()) {
+ $default_icon = 'fa-thumb-tack green';
+ $default_text = pht('Current Default');
+ } else if ($item->canMakeDefault()) {
+ $default_icon = 'fa-thumb-tack';
+ $default_text = pht('Make Default');
+ }
}
if ($default_text !== null) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 9, 2:23 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7385815
Default Alt Text
D17298.id41617.diff (2 KB)
Attached To
Mode
D17298: Remove menu item pinning from Home and Favorites profile menus
Attached
Detach File
Event Timeline
Log In to Comment