diff --git a/src/applications/maniphest/editor/ManiphestTransactionEditorPro.php b/src/applications/maniphest/editor/ManiphestTransactionEditorPro.php index 617ecede6a..fe992aa1a0 100644 --- a/src/applications/maniphest/editor/ManiphestTransactionEditorPro.php +++ b/src/applications/maniphest/editor/ManiphestTransactionEditorPro.php @@ -15,6 +15,7 @@ final class ManiphestTransactionEditorPro $types[] = ManiphestTransactionPro::TYPE_CCS; $types[] = ManiphestTransactionPro::TYPE_PROJECTS; $types[] = ManiphestTransactionPro::TYPE_ATTACH; + $types[] = ManiphestTransactionPro::TYPE_EDGE; return $types; } @@ -40,6 +41,9 @@ final class ManiphestTransactionEditorPro return $object->getProjectPHIDs(); case ManiphestTransactionPro::TYPE_ATTACH: return $object->getAttached(); + case ManiphestTransactionPro::TYPE_EDGE: + // These are pre-populated. + return $xaction->getOldValue(); } } @@ -58,6 +62,7 @@ final class ManiphestTransactionEditorPro case ManiphestTransactionPro::TYPE_CCS: case ManiphestTransactionPro::TYPE_PROJECTS: case ManiphestTransactionPro::TYPE_ATTACH: + case ManiphestTransactionPro::TYPE_EDGE: return $xaction->getNewValue(); } @@ -84,6 +89,10 @@ final class ManiphestTransactionEditorPro return $object->setProjectPHIDs($xaction->getNewValue()); case ManiphestTransactionPro::TYPE_ATTACH: return $object->setAttached($xaction->getNewValue()); + case ManiphestTransactionPro::TYPE_EDGE: + // These are a weird, funky mess and are already being applied by the + // time we reach this. + return; } } diff --git a/src/applications/maniphest/event/ManiphestEdgeEventListener.php b/src/applications/maniphest/event/ManiphestEdgeEventListener.php index 2e79789619..1fbae1f9fa 100644 --- a/src/applications/maniphest/event/ManiphestEdgeEventListener.php +++ b/src/applications/maniphest/event/ManiphestEdgeEventListener.php @@ -55,9 +55,16 @@ final class ManiphestEdgeEventListener extends PhutilEventListener { unset($this->edges[$id]); unset($this->tasks[$id]); + $content_source = PhabricatorContentSource::newForSource( + PhabricatorContentSource::SOURCE_LEGACY, + array()); + $new_edges = $this->loadAllEdges($event); - $editor = new ManiphestTransactionEditor(); - $editor->setActor($event->getUser()); + $editor = id(new ManiphestTransactionEditorPro()) + ->setActor($event->getUser()) + ->setContentSource($content_source) + ->setContinueOnNoEffect(true) + ->setContinueOnMissingFields(true); foreach ($tasks as $phid => $task) { $xactions = array(); @@ -74,16 +81,11 @@ final class ManiphestEdgeEventListener extends PhutilEventListener { continue; } - $xactions[] = id(new ManiphestTransaction()) + $xactions[] = id(new ManiphestTransactionPro()) ->setTransactionType(ManiphestTransactionType::TYPE_EDGE) ->setOldValue($old_type) ->setNewValue($new_type) - ->setMetadataValue('edge:type', $type) - ->setContentSource( - PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array())) - ->setAuthorPHID($event->getUser()->getPHID()); + ->setMetadataValue('edge:type', $type); } if ($xactions) { diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 254969cb2b..09d4b44740 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -657,8 +657,17 @@ abstract class PhabricatorApplicationTransactionEditor "You can not apply transactions which already have commentVersions!"); } - $custom_field_type = PhabricatorTransactions::TYPE_CUSTOMFIELD; - if ($xaction->getTransactionType() != $custom_field_type) { + $exempt_types = array( + // CustomField logic currently prefills these before we enter the + // transaction editor. + PhabricatorTransactions::TYPE_CUSTOMFIELD => true, + + // TODO: Remove this, this edge type is encumbered with a bunch of + // legacy nonsense. + ManiphestTransactionPro::TYPE_EDGE => true, + ); + + if (empty($exempt_types[$xaction->getTransactionType()])) { if ($xaction->getOldValue() !== null) { throw new Exception( "You can not apply transactions which already have oldValue!");