Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13987844
D9852.id23814.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
14 KB
Referenced Files
None
Subscribers
None
D9852.id23814.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -945,7 +945,6 @@
'ManiphestTaskMailReceiver' => 'applications/maniphest/mail/ManiphestTaskMailReceiver.php',
'ManiphestTaskOwner' => 'applications/maniphest/constants/ManiphestTaskOwner.php',
'ManiphestTaskPriority' => 'applications/maniphest/constants/ManiphestTaskPriority.php',
- 'ManiphestTaskProject' => 'applications/maniphest/storage/ManiphestTaskProject.php',
'ManiphestTaskQuery' => 'applications/maniphest/query/ManiphestTaskQuery.php',
'ManiphestTaskResultListView' => 'applications/maniphest/view/ManiphestTaskResultListView.php',
'ManiphestTaskSearchEngine' => 'applications/maniphest/query/ManiphestTaskSearchEngine.php',
@@ -3730,7 +3729,6 @@
'ManiphestTaskMailReceiver' => 'PhabricatorObjectMailReceiver',
'ManiphestTaskOwner' => 'ManiphestConstants',
'ManiphestTaskPriority' => 'ManiphestConstants',
- 'ManiphestTaskProject' => 'ManiphestDAO',
'ManiphestTaskQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'ManiphestTaskResultListView' => 'ManiphestView',
'ManiphestTaskSearchEngine' => 'PhabricatorApplicationSearchEngine',
diff --git a/src/applications/maniphest/conduit/ConduitAPI_maniphest_Method.php b/src/applications/maniphest/conduit/ConduitAPI_maniphest_Method.php
--- a/src/applications/maniphest/conduit/ConduitAPI_maniphest_Method.php
+++ b/src/applications/maniphest/conduit/ConduitAPI_maniphest_Method.php
@@ -116,18 +116,27 @@
$changes[ManiphestTransaction::TYPE_CCS] = $ccs;
}
+ $transactions = array();
+
$project_phids = $request->getValue('projectPHIDs');
if ($project_phids !== null) {
$this->validatePHIDList(
$project_phids,
PhabricatorProjectPHIDTypeProject::TYPECONST,
'projectPHIDS');
- $changes[ManiphestTransaction::TYPE_PROJECTS] = $project_phids;
+
+ $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
+ $transactions[] = id(new ManiphestTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $project_type)
+ ->setNewValue(
+ array(
+ '=' => array_fuse($project_phids),
+ ));
}
$template = new ManiphestTransaction();
- $transactions = array();
foreach ($changes as $type => $value) {
$transaction = clone $template;
$transaction->setTransactionType($type);
diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php
--- a/src/applications/maniphest/controller/ManiphestBatchEditController.php
+++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php
@@ -321,6 +321,18 @@
id(new ManiphestTransactionComment())
->setContent($value));
break;
+ case ManiphestTransaction::TYPE_PROJECTS:
+
+ // TODO: Clean this mess up.
+ $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
+ $xaction
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $project_type)
+ ->setNewValue(
+ array(
+ '=' => array_fuse($value),
+ ));
+ break;
default:
$xaction->setNewValue($value);
break;
diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php
--- a/src/applications/maniphest/controller/ManiphestTaskEditController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php
@@ -269,6 +269,17 @@
if ($type == ManiphestTransaction::TYPE_PROJECT_COLUMN) {
$transaction->setNewValue($value['new']);
$transaction->setOldValue($value['old']);
+ } else if ($type == ManiphestTransaction::TYPE_PROJECTS) {
+ // TODO: Gross.
+ $project_type =
+ PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
+ $transaction
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $project_type)
+ ->setNewValue(
+ array(
+ '=' => array_fuse($value),
+ ));
} else {
$transaction->setNewValue($value);
}
diff --git a/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php b/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php
--- a/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php
+++ b/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php
@@ -83,14 +83,19 @@
$value = array();
}
- $phids = $value;
- foreach ($task->getProjectPHIDs() as $project_phid) {
+ $phids = array();
+ $value = array_fuse($value);
+ foreach ($value as $project_phid) {
$phids[] = $project_phid;
- $value[] = $project_phid;
+ $value[$project_phid] = array('dst' => $project_phid);
}
- $transaction->setOldValue($task->getProjectPHIDs());
- $transaction->setNewValue($value);
+ $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
+ $transaction
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $project_type)
+ ->setOldValue(array())
+ ->setNewValue($value);
break;
case ManiphestTransaction::TYPE_STATUS:
$phids = array();
diff --git a/src/applications/maniphest/controller/ManiphestTransactionSaveController.php b/src/applications/maniphest/controller/ManiphestTransactionSaveController.php
--- a/src/applications/maniphest/controller/ManiphestTransactionSaveController.php
+++ b/src/applications/maniphest/controller/ManiphestTransactionSaveController.php
@@ -53,7 +53,16 @@
$projects = array_merge($projects, $task->getProjectPHIDs());
$projects = array_filter($projects);
$projects = array_unique($projects);
- $transaction->setNewValue($projects);
+
+ // TODO: Bleh.
+ $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
+ $transaction
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $project_type)
+ ->setNewValue(
+ array(
+ '+' => array_fuse($projects),
+ ));
break;
case ManiphestTransaction::TYPE_CCS:
// Accumulate the new explicit CCs into the array that we'll add in
diff --git a/src/applications/maniphest/editor/ManiphestTransactionEditor.php b/src/applications/maniphest/editor/ManiphestTransactionEditor.php
--- a/src/applications/maniphest/editor/ManiphestTransactionEditor.php
+++ b/src/applications/maniphest/editor/ManiphestTransactionEditor.php
@@ -16,7 +16,6 @@
$types[] = ManiphestTransaction::TYPE_DESCRIPTION;
$types[] = ManiphestTransaction::TYPE_OWNER;
$types[] = ManiphestTransaction::TYPE_CCS;
- $types[] = ManiphestTransaction::TYPE_PROJECTS;
$types[] = ManiphestTransaction::TYPE_SUBPRIORITY;
$types[] = ManiphestTransaction::TYPE_PROJECT_COLUMN;
$types[] = ManiphestTransaction::TYPE_UNBLOCK;
@@ -55,8 +54,6 @@
return nonempty($object->getOwnerPHID(), null);
case ManiphestTransaction::TYPE_CCS:
return array_values(array_unique($object->getCCPHIDs()));
- case ManiphestTransaction::TYPE_PROJECTS:
- return array_values(array_unique($object->getProjectPHIDs()));
case ManiphestTransaction::TYPE_PROJECT_COLUMN:
// These are pre-populated.
return $xaction->getOldValue();
@@ -74,7 +71,6 @@
case ManiphestTransaction::TYPE_PRIORITY:
return (int)$xaction->getNewValue();
case ManiphestTransaction::TYPE_CCS:
- case ManiphestTransaction::TYPE_PROJECTS:
return array_values(array_unique($xaction->getNewValue()));
case ManiphestTransaction::TYPE_OWNER:
return nonempty($xaction->getNewValue(), null);
@@ -97,7 +93,6 @@
$new = $xaction->getNewValue();
switch ($xaction->getTransactionType()) {
- case ManiphestTransaction::TYPE_PROJECTS:
case ManiphestTransaction::TYPE_CCS:
sort($old);
sort($new);
@@ -149,11 +144,6 @@
return $object->setOwnerPHID($phid);
case ManiphestTransaction::TYPE_CCS:
return $object->setCCPHIDs($xaction->getNewValue());
- case ManiphestTransaction::TYPE_PROJECTS:
- ManiphestTaskProject::updateTaskProjects(
- $object,
- $xaction->getNewValue());
- return $object;
case ManiphestTransaction::TYPE_SUBPRIORITY:
$data = $xaction->getNewValue();
$new_sub = $this->getNextSubpriority(
@@ -425,15 +415,14 @@
$project_phids = $adapter->getProjectPHIDs();
if ($project_phids) {
- $existing_projects = $object->getProjectPHIDs();
- $new_projects = array_unique(
- array_merge(
- $project_phids,
- $existing_projects));
-
+ $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
$xactions[] = id(new ManiphestTransaction())
- ->setTransactionType(ManiphestTransaction::TYPE_PROJECTS)
- ->setNewValue($new_projects);
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $project_type)
+ ->setNewValue(
+ array(
+ '+' => array_fuse($project_phids),
+ ));
}
return $xactions;
@@ -450,8 +439,6 @@
ManiphestCapabilityEditPriority::CAPABILITY,
ManiphestTransaction::TYPE_STATUS =>
ManiphestCapabilityEditStatus::CAPABILITY,
- ManiphestTransaction::TYPE_PROJECTS =>
- ManiphestCapabilityEditProjects::CAPABILITY,
ManiphestTransaction::TYPE_OWNER =>
ManiphestCapabilityEditAssign::CAPABILITY,
PhabricatorTransactions::TYPE_EDIT_POLICY =>
@@ -460,8 +447,19 @@
ManiphestCapabilityEditPolicies::CAPABILITY,
);
+
$transaction_type = $xaction->getTransactionType();
- $app_capability = idx($app_capability_map, $transaction_type);
+
+ $app_capability = null;
+ if ($transaction_type == PhabricatorTransactions::TYPE_EDGE) {
+ switch ($xaction->getMetadataValue('edge:type')) {
+ case PhabricatorProjectObjectHasProjectEdgeType::EDGECONST:
+ $app_capability = ManiphestCapabilityEditProjects::CAPABILITY;
+ break;
+ }
+ } else {
+ $app_capability = idx($app_capability_map, $transaction_type);
+ }
if ($app_capability) {
$app = id(new PhabricatorApplicationQuery())
diff --git a/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php b/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php
--- a/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php
+++ b/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php
@@ -30,8 +30,6 @@
$this->generateTaskPriority();
$changes[ManiphestTransaction::TYPE_CCS] =
$this->getCCPHIDs();
- $changes[ManiphestTransaction::TYPE_PROJECTS] =
- $this->getProjectPHIDs();
$transactions = array();
foreach ($changes as $type => $value) {
$transaction = clone $template;
diff --git a/src/applications/maniphest/storage/ManiphestTaskProject.php b/src/applications/maniphest/storage/ManiphestTaskProject.php
deleted file mode 100644
--- a/src/applications/maniphest/storage/ManiphestTaskProject.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-/**
- * This is a DAO for the Task -> Project table, which denormalizes the
- * relationship between tasks and projects into a link table so it can be
- * efficiently queried. This table is not authoritative; the projectPHIDs field
- * of ManiphestTask is. The rows in this table are regenerated when transactions
- * are applied to tasks which affected their associated projects.
- */
-final class ManiphestTaskProject extends ManiphestDAO {
-
- protected $taskPHID;
- protected $projectPHID;
-
- public function getConfiguration() {
- return array(
- self::CONFIG_IDS => self::IDS_MANUAL,
- self::CONFIG_TIMESTAMPS => false,
- );
- }
-
- public static function updateTaskProjects(
- ManiphestTask $task,
- array $new_phids) {
-
- $edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
-
- $old_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
- $task->getPHID(),
- $edge_type);
-
- $add_phids = array_diff($new_phids, $old_phids);
- $rem_phids = array_diff($old_phids, $new_phids);
-
- if (!$add_phids && !$rem_phids) {
- return;
- }
-
- $editor = new PhabricatorEdgeEditor();
- foreach ($add_phids as $phid) {
- $editor->addEdge($task->getPHID(), $edge_type, $phid);
- }
- foreach ($rem_phids as $phid) {
- $editor->remEdge($task->getPHID(), $edge_type, $phid);
- }
- $editor->save();
- }
-
-}
diff --git a/src/applications/maniphest/storage/ManiphestTransaction.php b/src/applications/maniphest/storage/ManiphestTransaction.php
--- a/src/applications/maniphest/storage/ManiphestTransaction.php
+++ b/src/applications/maniphest/storage/ManiphestTransaction.php
@@ -788,8 +788,15 @@
case self::TYPE_CCS:
$tags[] = MetaMTANotificationType::TYPE_MANIPHEST_CC;
break;
- case self::TYPE_PROJECTS:
- $tags[] = MetaMTANotificationType::TYPE_MANIPHEST_PROJECTS;
+ case PhabricatorTransactions::TYPE_EDGE:
+ switch ($this->getMetadataValue('edge:type')) {
+ case PhabricatorProjectObjectHasProjectEdgeType::EDGECONST:
+ $tags[] = MetaMTANotificationType::TYPE_MANIPHEST_PROJECTS;
+ break;
+ default:
+ $tags[] = MetaMTANotificationType::TYPE_MANIPHEST_OTHER;
+ break;
+ }
break;
case self::TYPE_PRIORITY:
$tags[] = MetaMTANotificationType::TYPE_MANIPHEST_PRIORITY;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 22, 11:40 AM (1 w, 15 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6741636
Default Alt Text
D9852.id23814.diff (14 KB)
Attached To
Mode
D9852: Stop writing new TYPE_PROJECTS transactions to Maniphest
Attached
Detach File
Event Timeline
Log In to Comment