diff --git a/src/applications/differential/mail/comment/DifferentialCommentMail.php b/src/applications/differential/mail/comment/DifferentialCommentMail.php index 2a1bd2cf16..a206a7aab4 100755 --- a/src/applications/differential/mail/comment/DifferentialCommentMail.php +++ b/src/applications/differential/mail/comment/DifferentialCommentMail.php @@ -103,9 +103,9 @@ class DifferentialCommentMail extends DifferentialMail { $revision = $this->getRevision(); if ($revision->getStatus() == DifferentialRevisionStatus::COMMITTED) { /* - + TODO - + $rev_ref = $revision->getRevisionRef(); if ($rev_ref) { $body[] = " Detail URL: ".$rev_ref->getDetailURL(); diff --git a/src/applications/maniphest/controller/transactionsave/ManiphestTransactionSaveController.php b/src/applications/maniphest/controller/transactionsave/ManiphestTransactionSaveController.php index 7d87e6c031..c4c22c61b8 100644 --- a/src/applications/maniphest/controller/transactionsave/ManiphestTransactionSaveController.php +++ b/src/applications/maniphest/controller/transactionsave/ManiphestTransactionSaveController.php @@ -49,6 +49,7 @@ class ManiphestTransactionSaveController extends ManiphestController { case ManiphestTransactionType::TYPE_CCS: $ccs = $request->getArr('ccs'); $ccs = array_merge($ccs, $task->getCCPHIDs()); + $ccs = array_filter($ccs); $ccs = array_unique($ccs); $transaction->setNewValue($ccs); break; @@ -59,8 +60,31 @@ class ManiphestTransactionSaveController extends ManiphestController { throw new Exception('unknown action'); } + $transactions = array($transaction); + + switch ($action) { + case ManiphestTransactionType::TYPE_OWNER: + if ($task->getOwnerPHID() == $transaction->getNewValue()) { + // If this is actually no-op, don't generate the side effect. + break; + } + // When a task is reassigned, move the previous owner to CC. + $old = $task->getCCPHIDs(); + $new = array_merge( + $old, + array($task->getOwnerPHID())); + $new = array_unique(array_filter($new)); + if ($old != $new) { + $cc = clone $transaction; + $cc->setTransactionType(ManiphestTransactionType::TYPE_CCS); + $cc->setNewValue($new); + $transactions[] = $cc; + } + break; + } + $editor = new ManiphestTransactionEditor(); - $editor->applyTransactions($task, array($transaction)); + $editor->applyTransactions($task, $transactions); return id(new AphrontRedirectResponse()) ->setURI('/T'.$task->getID()); diff --git a/src/applications/maniphest/editor/transaction/ManiphestTransactionEditor.php b/src/applications/maniphest/editor/transaction/ManiphestTransactionEditor.php index ca02201f42..ce49423785 100644 --- a/src/applications/maniphest/editor/transaction/ManiphestTransactionEditor.php +++ b/src/applications/maniphest/editor/transaction/ManiphestTransactionEditor.php @@ -25,7 +25,7 @@ class ManiphestTransactionEditor { $email_to = array(); $email_to[] = $task->getOwnerPHID(); - foreach ($transactions as $transaction) { + foreach ($transactions as $key => $transaction) { $type = $transaction->getTransactionType(); $new = $transaction->getNewValue(); $email_to[] = $transaction->getAuthorPHID(); @@ -51,9 +51,17 @@ class ManiphestTransactionEditor { } if (($old !== null) && ($old == $new)) { - $transaction->setOldValue(null); - $transaction->setNewValue(null); - $transaction->setTransactionType(ManiphestTransactionType::TYPE_NONE); + if (count($transactions) > 1 && !$transaction->hasComments()) { + // If we have at least one other transaction and this one isn't + // doing anything and doesn't have any comments, just throw it + // away. + unset($transactions[$key]); + continue; + } else { + $transaction->setOldValue(null); + $transaction->setNewValue(null); + $transaction->setTransactionType(ManiphestTransactionType::TYPE_NONE); + } } else { switch ($type) { case ManiphestTransactionType::TYPE_NONE: