Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15461473
D17445.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D17445.diff
View Options
diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
--- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -267,7 +267,7 @@
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
- $edit_config = $edit_engine->loadDefaultEditConfiguration();
+ $edit_config = $edit_engine->loadDefaultEditConfiguration($task);
$can_create = (bool)$edit_config;
$can_reassign = $edit_engine->hasEditAccessToTransaction(
diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
--- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php
+++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
@@ -910,7 +910,7 @@
// for each column or board?
$edit_config = id(new ManiphestEditEngine())
->setViewer($viewer)
- ->loadDefaultEditConfiguration();
+ ->loadDefaultEditConfiguration(new ManiphestTask());
if ($edit_config) {
$form_key = $edit_config->getIdentifier();
$create_uri = "/maniphest/task/edit/form/{$form_key}/";
diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php
--- a/src/applications/transactions/editengine/PhabricatorEditEngine.php
+++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php
@@ -408,11 +408,20 @@
'getCreateSortKey');
}
- public function loadDefaultEditConfiguration() {
+ public function loadDefaultEditConfiguration($object) {
$query = $this->newConfigurationQuery()
->withIsEdit(true)
->withIsDisabled(false);
+ // If this object supports subtyping, we edit it with a form of the same
+ // subtype: so "bug" tasks get edited with "bug" forms.
+ if ($object instanceof PhabricatorEditEngineSubtypeInterface) {
+ $query->withSubtypes(
+ array(
+ $object->getEditEngineSubtype(),
+ ));
+ }
+
return $this->loadEditEngineConfigurationWithQuery(
$query,
'getEditSortKey');
@@ -891,7 +900,7 @@
}
} else {
if ($id) {
- $config = $this->loadDefaultEditConfiguration();
+ $config = $this->loadDefaultEditConfiguration($object);
if (!$config) {
return $this->buildNoEditResponse($object);
}
@@ -1370,16 +1379,16 @@
final public function hasEditAccessToTransaction($xaction_type) {
$viewer = $this->getViewer();
- $config = $this->loadDefaultEditConfiguration();
- if (!$config) {
- return false;
- }
-
$object = $this->getTargetObject();
if (!$object) {
$object = $this->newEditableObject();
}
+ $config = $this->loadDefaultEditConfiguration($object);
+ if (!$config) {
+ return false;
+ }
+
$fields = $this->buildEditFields($object);
$field = null;
@@ -1535,7 +1544,7 @@
}
final public function buildEditEngineCommentView($object) {
- $config = $this->loadDefaultEditConfiguration();
+ $config = $this->loadDefaultEditConfiguration($object);
if (!$config) {
// TODO: This just nukes the entire comment form if you don't have access
@@ -1755,7 +1764,7 @@
return new Aphront400Response();
}
- $config = $this->loadDefaultEditConfiguration();
+ $config = $this->loadDefaultEditConfiguration($object);
if (!$config) {
return new Aphront404Response();
}
diff --git a/src/applications/transactions/query/PhabricatorEditEngineConfigurationQuery.php b/src/applications/transactions/query/PhabricatorEditEngineConfigurationQuery.php
--- a/src/applications/transactions/query/PhabricatorEditEngineConfigurationQuery.php
+++ b/src/applications/transactions/query/PhabricatorEditEngineConfigurationQuery.php
@@ -12,6 +12,7 @@
private $isEdit;
private $disabled;
private $ignoreDatabaseConfigurations;
+ private $subtypes;
public function withIDs(array $ids) {
$this->ids = $ids;
@@ -58,6 +59,11 @@
return $this;
}
+ public function withSubtypes(array $subtypes) {
+ $this->subtypes = $subtypes;
+ return $this;
+ }
+
public function newResultObject() {
return new PhabricatorEditEngineConfiguration();
}
@@ -183,6 +189,17 @@
}
}
+ if ($this->subtypes !== null) {
+ $subtypes = array_fuse($this->subtypes);
+ foreach ($page as $key => $config) {
+ if (isset($subtypes[$config->getSubtype()])) {
+ continue;
+ }
+
+ unset($page[$key]);
+ }
+ }
+
return $page;
}
@@ -250,6 +267,13 @@
$this->identifiers);
}
+ if ($this->subtypes !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'subtype IN (%Ls)',
+ $this->subtypes);
+ }
+
return $where;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 2, 8:34 AM (3 d, 12 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7286522
Default Alt Text
D17445.diff (4 KB)
Attached To
Mode
D17445: When editing a subtyped object, use edit forms of the same subtype
Attached
Detach File
Event Timeline
Log In to Comment