mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 03:20:59 +01:00
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
This commit is contained in:
parent
363084d4fa
commit
8a85ee7c15
5 changed files with 49 additions and 4 deletions
2
resources/sql/autopatches/20170106.menu.01.customphd.sql
Normal file
2
resources/sql/autopatches/20170106.menu.01.customphd.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_search.search_profilepanelconfiguration
|
||||
ADD customPHID VARBINARY(64);
|
|
@ -7,6 +7,7 @@ final class PhabricatorProfileMenuEditEngine
|
|||
|
||||
private $menuEngine;
|
||||
private $profileObject;
|
||||
private $customPHID;
|
||||
private $newMenuItemConfiguration;
|
||||
private $isBuiltin;
|
||||
|
||||
|
@ -32,6 +33,15 @@ final class PhabricatorProfileMenuEditEngine
|
|||
return $this->profileObject;
|
||||
}
|
||||
|
||||
public function setCustomPHID($custom_phid) {
|
||||
$this->customPHID = $custom_phid;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomPHID() {
|
||||
return $this->customPHID;
|
||||
}
|
||||
|
||||
public function setNewMenuItemConfiguration(
|
||||
PhabricatorProfileMenuItemConfiguration $configuration) {
|
||||
$this->newMenuItemConfiguration = $configuration;
|
||||
|
|
|
@ -4,6 +4,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
|
|||
|
||||
private $viewer;
|
||||
private $profileObject;
|
||||
private $customPHID;
|
||||
private $items;
|
||||
private $defaultItem;
|
||||
private $controller;
|
||||
|
@ -27,6 +28,15 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
|
|||
return $this->profileObject;
|
||||
}
|
||||
|
||||
public function setCustomPHID($custom_phid) {
|
||||
$this->customPHID = $custom_phid;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomPHID() {
|
||||
return $this->customPHID;
|
||||
}
|
||||
|
||||
public function setController(PhabricatorController $controller) {
|
||||
$this->controller = $controller;
|
||||
return $this;
|
||||
|
@ -244,10 +254,18 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
|
|||
|
||||
$items = $this->loadBuiltinProfileItems();
|
||||
|
||||
$stored_items = id(new PhabricatorProfileMenuItemConfigurationQuery())
|
||||
->setViewer($viewer)
|
||||
->withProfilePHIDs(array($object->getPHID()))
|
||||
->execute();
|
||||
if ($this->getCustomPHID()) {
|
||||
$stored_items = id(new PhabricatorProfileMenuItemConfigurationQuery())
|
||||
->setViewer($viewer)
|
||||
->withProfilePHIDs(array($object->getPHID()))
|
||||
->withCustomPHIDs(array($this->getCustomPHID()))
|
||||
->execute();
|
||||
} else {
|
||||
$stored_items = id(new PhabricatorProfileMenuItemConfigurationQuery())
|
||||
->setViewer($viewer)
|
||||
->withProfilePHIDs(array($object->getPHID()))
|
||||
->execute();
|
||||
}
|
||||
|
||||
foreach ($stored_items as $stored_item) {
|
||||
$impl = $stored_item->getMenuItem();
|
||||
|
|
|
@ -6,6 +6,7 @@ final class PhabricatorProfileMenuItemConfigurationQuery
|
|||
private $ids;
|
||||
private $phids;
|
||||
private $profilePHIDs;
|
||||
private $customPHIDs;
|
||||
|
||||
public function withIDs(array $ids) {
|
||||
$this->ids = $ids;
|
||||
|
@ -22,6 +23,11 @@ final class PhabricatorProfileMenuItemConfigurationQuery
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function withCustomPHIDs(array $phids) {
|
||||
$this->customPHIDs = $phids;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function newResultObject() {
|
||||
return new PhabricatorProfileMenuItemConfiguration();
|
||||
}
|
||||
|
@ -54,6 +60,13 @@ final class PhabricatorProfileMenuItemConfigurationQuery
|
|||
$this->profilePHIDs);
|
||||
}
|
||||
|
||||
if ($this->customPHIDs !== null) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'customPHID IN (%Ls)',
|
||||
$this->customPHIDs);
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ final class PhabricatorProfileMenuItemConfiguration
|
|||
protected $builtinKey;
|
||||
protected $menuItemOrder;
|
||||
protected $visibility;
|
||||
protected $customPHID;
|
||||
protected $menuItemProperties = array();
|
||||
|
||||
private $profileObject = self::ATTACHABLE;
|
||||
|
@ -52,6 +53,7 @@ final class PhabricatorProfileMenuItemConfiguration
|
|||
'menuItemKey' => 'text64',
|
||||
'builtinKey' => 'text64?',
|
||||
'menuItemOrder' => 'uint32?',
|
||||
'customPHID' => 'phid?',
|
||||
'visibility' => 'text32',
|
||||
),
|
||||
self::CONFIG_KEY_SCHEMA => array(
|
||||
|
|
Loading…
Reference in a new issue