From 6b39af4022e2d7765f9f27c84ef745795599b318 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 23 Oct 2012 12:02:40 -0700 Subject: [PATCH] Mark Maniphest notifications read if we send the user an email Summary: See D3784, T1403. When we send a user an email and a notification from Maniphest, mark the notification as read. (It would be nice to do the thing with `multiplexMail()` a little less hackily, but it gets very complicated to do correctly because we require handles but sometimes do not have an actor/user so I'm punting for now.) Test Plan: Acted on a task, verified notification was marked read because I received an email. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Maniphest Tasks: T1403 Differential Revision: https://secure.phabricator.com/D3789 --- .../editor/ManiphestTransactionEditor.php | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/applications/maniphest/editor/ManiphestTransactionEditor.php b/src/applications/maniphest/editor/ManiphestTransactionEditor.php index 0570a200e9..72ad7f1b89 100644 --- a/src/applications/maniphest/editor/ManiphestTransactionEditor.php +++ b/src/applications/maniphest/editor/ManiphestTransactionEditor.php @@ -218,12 +218,16 @@ final class ManiphestTransactionEditor extends PhabricatorEditor { $email_cc, $task->getCCPHIDs()); - $this->publishFeedStory($task, $transactions); + $mail = $this->sendEmail($task, $transactions, $email_to, $email_cc); - // TODO: Do this offline via timeline + $this->publishFeedStory( + $task, + $transactions, + $mail->buildRecipientList()); + + // TODO: Do this offline via workers PhabricatorSearchManiphestIndexer::indexTask($task); - $this->sendEmail($task, $transactions, $email_to, $email_cc); } protected function getSubjectPrefix() { @@ -300,6 +304,10 @@ final class ManiphestTransactionEditor extends PhabricatorEditor { foreach ($mails as $mail) { $mail->saveAndSend(); } + + $template->addTos($email_to); + $template->addCCs($email_cc); + return $template; } public function buildReplyHandler(ManiphestTask $task) { @@ -310,7 +318,10 @@ final class ManiphestTransactionEditor extends PhabricatorEditor { return $handler_object; } - private function publishFeedStory(ManiphestTask $task, array $transactions) { + private function publishFeedStory( + ManiphestTask $task, + array $transactions, + array $mailed_phids) { assert_instances_of($transactions, 'ManiphestTransaction'); $actions = array(ManiphestAction::ACTION_UPDATE); @@ -344,9 +355,8 @@ final class ManiphestTransactionEditor extends PhabricatorEditor { $actor_phid = head($transactions)->getAuthorPHID(); $author_phid = $task->getAuthorPHID(); - id(new PhabricatorFeedStoryPublisher()) - ->setStoryType(PhabricatorFeedStoryTypeConstants::STORY_MANIPHEST) + ->setStoryType('PhabricatorFeedStoryManiphest') ->setStoryData(array( 'taskPHID' => $task->getPHID(), 'transactionIDs' => mpull($transactions, 'getID'), @@ -376,6 +386,7 @@ final class ManiphestTransactionEditor extends PhabricatorEditor { $owner_phid, $actor_phid)), $task->getCCPHIDs())) + ->setMailRecipientPHIDs($mailed_phids) ->publish(); }