Commit feaa199c authored by Daniel Stone's avatar Daniel Stone Committed by Ana Rute Mendes

Preserve silent and time when updating blocked tasks

Ref T13042. Updating blocked tasks creates a new ManiphestTransactionEditor instance from within the current transaction application, which fails to carry over all of the current properties. Failing to update silent means that mails will be generated for updates to blocked tasks, regardless of the setting for the original transaction editor.

Failing to preserve the time can also give large time deltas in corner cases, such as running an importer which pulls tasks from yesteryear.

This equally applies to inverse-edge transactions, though I don't have a ready-made usecase for those.
parent d5a7d408
......@@ -123,13 +123,15 @@ final class ManiphestTransactionEditor
$old = $unblock_xaction->getOldValue();
$new = $unblock_xaction->getNewValue();
$date = $unblock_xaction->getDateCreated();
foreach ($blocked_tasks as $blocked_task) {
$parent_xaction = id(new ManiphestTransaction())
->setTransactionType(
ManiphestTaskUnblockTransaction::TRANSACTIONTYPE)
->setOldValue(array($object->getPHID() => $old))
->setNewValue(array($object->getPHID() => $new));
->setNewValue(array($object->getPHID() => $new))
->setDateCreated($date);
if ($this->getIsNewObject()) {
$parent_xaction->setMetadataValue('blocker.new', true);
......@@ -138,6 +140,7 @@ final class ManiphestTransactionEditor
$this->newSubEditor()
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
->setIsSilent($this->getIsSilent())
->applyTransactions($blocked_task, array($parent_xaction));
}
}
......
......@@ -4167,6 +4167,7 @@ abstract class PhabricatorApplicationTransactionEditor
$template
->setTransactionType($xaction->getTransactionType())
->setMetadataValue('edge:type', $inverse_type)
->setDateCreated($xaction->getDateCreated())
->setOldValue($old_phids)
->setNewValue($new_phids);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment