1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Route reply handler Maniphest writes through new transaction code

Summary: Ref T2217. Mail writes go through the new code now.

Test Plan: Shipped a bunch of mail in with `./bin/mail`, got reasonable edits as a result.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2217

Differential Revision: https://secure.phabricator.com/D7086
This commit is contained in:
epriestley 2013-09-23 14:32:51 -07:00
parent 889eac44ae
commit 11c7eee783

View file

@ -56,9 +56,7 @@ final class ManiphestReplyHandler extends PhabricatorMailReplyHandler {
'id' => $mail->getID(),
));
$template = new ManiphestTransaction();
$template->setContentSource($content_source);
$template->setAuthorPHID($user->getPHID());
$template = new ManiphestTransactionPro();
$is_unsub = false;
if ($is_new_task) {
@ -112,12 +110,22 @@ final class ManiphestReplyHandler extends PhabricatorMailReplyHandler {
break;
}
$xaction = clone $template;
$xaction->setTransactionType($ttype);
$xaction->setNewValue($new_value);
$xaction->setComments($body);
if ($ttype != PhabricatorTransactions::TYPE_COMMENT) {
$xaction = clone $template;
$xaction->setTransactionType($ttype);
$xaction->setNewValue($new_value);
$xactions[] = $xaction;
}
if (strlen($body)) {
$xaction = clone $template;
$xaction->setTransactionType(PhabricatorTransactions::TYPE_COMMENT);
$xaction->attachComment(
id(new ManiphestTransactionComment())
->setContent($body));
$xactions[] = $xaction;
}
$xactions[] = $xaction;
}
$ccs = $mail->loadCCPHIDs();
@ -149,13 +157,14 @@ final class ManiphestReplyHandler extends PhabricatorMailReplyHandler {
$task = $event->getValue('task');
$xactions = $event->getValue('transactions');
$editor = new ManiphestTransactionEditor();
$editor->setActor($user);
$editor->setParentMessageID($mail->getMessageID());
$editor->setExcludeMailRecipientPHIDs(
$this->getExcludeMailRecipientPHIDs());
$editor->applyTransactions($task, $xactions);
$editor = id(new ManiphestTransactionEditorPro())
->setActor($user)
->setParentMessageID($mail->getMessageID())
->setExcludeMailRecipientPHIDs($this->getExcludeMailRecipientPHIDs())
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
->setContentSource($content_source)
->applyTransactions($task, $xactions);
$event = new PhabricatorEvent(
PhabricatorEventType::TYPE_MANIPHEST_DIDEDITTASK,