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

Add CustomPHID to PhabricatorProfileMenuEngineConfiguration

Summary: Ref T5867, adds a customPHID field, nullable, and lets you query by it... i think? Not fully able to grok all the EditEngine stuff, but I think this is the right place for the query.

Test Plan: Not wired to anything, but pulling up project menu, editing, all still works.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T5867

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

+49 -4
+2
resources/sql/autopatches/20170106.menu.01.customphd.sql
··· 1 + ALTER TABLE {$NAMESPACE}_search.search_profilepanelconfiguration 2 + ADD customPHID VARBINARY(64);
+10
src/applications/search/editor/PhabricatorProfileMenuEditEngine.php
··· 7 7 8 8 private $menuEngine; 9 9 private $profileObject; 10 + private $customPHID; 10 11 private $newMenuItemConfiguration; 11 12 private $isBuiltin; 12 13 ··· 30 31 31 32 public function getProfileObject() { 32 33 return $this->profileObject; 34 + } 35 + 36 + public function setCustomPHID($custom_phid) { 37 + $this->customPHID = $custom_phid; 38 + return $this; 39 + } 40 + 41 + public function getCustomPHID() { 42 + return $this->customPHID; 33 43 } 34 44 35 45 public function setNewMenuItemConfiguration(
+22 -4
src/applications/search/engine/PhabricatorProfileMenuEngine.php
··· 4 4 5 5 private $viewer; 6 6 private $profileObject; 7 + private $customPHID; 7 8 private $items; 8 9 private $defaultItem; 9 10 private $controller; ··· 25 26 26 27 public function getProfileObject() { 27 28 return $this->profileObject; 29 + } 30 + 31 + public function setCustomPHID($custom_phid) { 32 + $this->customPHID = $custom_phid; 33 + return $this; 34 + } 35 + 36 + public function getCustomPHID() { 37 + return $this->customPHID; 28 38 } 29 39 30 40 public function setController(PhabricatorController $controller) { ··· 244 254 245 255 $items = $this->loadBuiltinProfileItems(); 246 256 247 - $stored_items = id(new PhabricatorProfileMenuItemConfigurationQuery()) 248 - ->setViewer($viewer) 249 - ->withProfilePHIDs(array($object->getPHID())) 250 - ->execute(); 257 + if ($this->getCustomPHID()) { 258 + $stored_items = id(new PhabricatorProfileMenuItemConfigurationQuery()) 259 + ->setViewer($viewer) 260 + ->withProfilePHIDs(array($object->getPHID())) 261 + ->withCustomPHIDs(array($this->getCustomPHID())) 262 + ->execute(); 263 + } else { 264 + $stored_items = id(new PhabricatorProfileMenuItemConfigurationQuery()) 265 + ->setViewer($viewer) 266 + ->withProfilePHIDs(array($object->getPHID())) 267 + ->execute(); 268 + } 251 269 252 270 foreach ($stored_items as $stored_item) { 253 271 $impl = $stored_item->getMenuItem();
+13
src/applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php
··· 6 6 private $ids; 7 7 private $phids; 8 8 private $profilePHIDs; 9 + private $customPHIDs; 9 10 10 11 public function withIDs(array $ids) { 11 12 $this->ids = $ids; ··· 19 20 20 21 public function withProfilePHIDs(array $phids) { 21 22 $this->profilePHIDs = $phids; 23 + return $this; 24 + } 25 + 26 + public function withCustomPHIDs(array $phids) { 27 + $this->customPHIDs = $phids; 22 28 return $this; 23 29 } 24 30 ··· 52 58 $conn, 53 59 'profilePHID IN (%Ls)', 54 60 $this->profilePHIDs); 61 + } 62 + 63 + if ($this->customPHIDs !== null) { 64 + $where[] = qsprintf( 65 + $conn, 66 + 'customPHID IN (%Ls)', 67 + $this->customPHIDs); 55 68 } 56 69 57 70 return $where;
+2
src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php
··· 12 12 protected $builtinKey; 13 13 protected $menuItemOrder; 14 14 protected $visibility; 15 + protected $customPHID; 15 16 protected $menuItemProperties = array(); 16 17 17 18 private $profileObject = self::ATTACHABLE; ··· 52 53 'menuItemKey' => 'text64', 53 54 'builtinKey' => 'text64?', 54 55 'menuItemOrder' => 'uint32?', 56 + 'customPHID' => 'phid?', 55 57 'visibility' => 'text32', 56 58 ), 57 59 self::CONFIG_KEY_SCHEMA => array(