Page MenuHomePhabricator

D18875.id45267.diff
No OneTemporary

D18875.id45267.diff

diff --git a/src/applications/transactions/bulk/PhabricatorEditEngineBulkJobType.php b/src/applications/transactions/bulk/PhabricatorEditEngineBulkJobType.php
--- a/src/applications/transactions/bulk/PhabricatorEditEngineBulkJobType.php
+++ b/src/applications/transactions/bulk/PhabricatorEditEngineBulkJobType.php
@@ -72,8 +72,8 @@
$xaction = $object->getApplicationTransactionTemplate()
->setTransactionType($raw_xaction['type']);
- if (isset($raw_xaction['value'])) {
- $xaction->setNewValue($raw_xaction['value']);
+ if (isset($raw_xaction['new'])) {
+ $xaction->setNewValue($raw_xaction['new']);
}
if (isset($raw_xaction['comment'])) {
@@ -88,6 +88,10 @@
}
}
+ if (array_key_exists('old', $raw_xaction)) {
+ $xaction->setOldValue($raw_xaction['old']);
+ }
+
$xactions[] = $xaction;
}
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
@@ -2472,14 +2472,15 @@
$fields = $this->buildEditFields($object);
$edit_types = $this->getBulkEditTypesFromFields($fields);
+ $template = $object->getApplicationTransactionTemplate();
+ $raw_xactions = array();
foreach ($xactions as $key => $xaction) {
PhutilTypeSpec::checkMap(
$xaction,
array(
'type' => 'string',
'value' => 'optional wild',
- 'comment' => 'optional string',
));
$type = $xaction['type'];
@@ -2497,18 +2498,31 @@
// but it's possible that this isn't the case.
$xaction['type'] = $edit_type->getTransactionType();
- $xaction['metadata'] = $edit_type->getMetadata();
+ $xaction_objects = $edit_type->generateTransactions(
+ clone $template,
+ $xaction);
- $xaction = $edit_type->newRawBulkTransaction($xaction);
- if ($xaction === null) {
- unset($xactions[$key]);
- continue;
- }
+ foreach ($xaction_objects as $xaction_object) {
+ $raw_xaction = array(
+ 'type' => $xaction_object->getTransactionType(),
+ 'metadata' => $xaction_object->getMetadata(),
+ 'new' => $xaction_object->getNewValue(),
+ );
- $xactions[$key] = $xaction;
+ if ($xaction_object->hasOldValue()) {
+ $raw_xaction['old'] = $xaction_object->getOldValue();
+ }
+
+ if ($xaction_object->hasComment()) {
+ $comment = $xaction_object->getComment();
+ $raw_xaction['comment'] = $comment->getContent();
+ }
+
+ $raw_xactions[] = $raw_xaction;
+ }
}
- return $xactions;
+ return $raw_xactions;
}
private function getBulkEditTypesFromFields(array $fields) {
diff --git a/src/applications/transactions/edittype/PhabricatorCommentEditType.php b/src/applications/transactions/edittype/PhabricatorCommentEditType.php
--- a/src/applications/transactions/edittype/PhabricatorCommentEditType.php
+++ b/src/applications/transactions/edittype/PhabricatorCommentEditType.php
@@ -10,17 +10,6 @@
return new BulkRemarkupParameterType();
}
- public function newRawBulkTransaction(array $xaction) {
- if (!strlen($xaction['value'])) {
- return null;
- }
-
- $xaction['comment'] = $xaction['value'];
- unset($xaction['value']);
-
- return $xaction;
- }
-
public function generateTransactions(
PhabricatorApplicationTransaction $template,
array $spec) {
diff --git a/src/applications/transactions/edittype/PhabricatorDatasourceEditType.php b/src/applications/transactions/edittype/PhabricatorDatasourceEditType.php
--- a/src/applications/transactions/edittype/PhabricatorDatasourceEditType.php
+++ b/src/applications/transactions/edittype/PhabricatorDatasourceEditType.php
@@ -19,20 +19,4 @@
return '?';
}
- public function newRawBulkTransaction(array $xaction) {
- $value = idx($xaction, 'value');
-
- if ($this->getIsSingleValue()) {
- if ($value) {
- $value = head($value);
- } else {
- $value = null;
- }
-
- $xaction['value'] = $value;
- }
-
- return $xaction;
- }
-
}
diff --git a/src/applications/transactions/edittype/PhabricatorEdgeEditType.php b/src/applications/transactions/edittype/PhabricatorEdgeEditType.php
--- a/src/applications/transactions/edittype/PhabricatorEdgeEditType.php
+++ b/src/applications/transactions/edittype/PhabricatorEdgeEditType.php
@@ -43,18 +43,4 @@
->setDatasource($this->getDatasource());
}
- public function newRawBulkTransaction(array $xaction) {
- $value = idx($xaction, 'value');
-
- if ($this->getEdgeOperation() !== null) {
- $value = array_fuse($value);
- $value = array(
- $this->getEdgeOperation() => $value,
- );
- $xaction['value'] = $value;
- }
-
- return $xaction;
- }
-
}
diff --git a/src/applications/transactions/edittype/PhabricatorEditType.php b/src/applications/transactions/edittype/PhabricatorEditType.php
--- a/src/applications/transactions/edittype/PhabricatorEditType.php
+++ b/src/applications/transactions/edittype/PhabricatorEditType.php
@@ -115,11 +115,6 @@
}
- public function newRawBulkTransaction(array $xaction) {
- return $xaction;
- }
-
-
/* -( Conduit )------------------------------------------------------------ */

File Metadata

Mime Type
text/plain
Expires
May 30 2024, 12:27 AM (6 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6288377
Default Alt Text
D18875.id45267.diff (5 KB)

Event Timeline