1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

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
This commit is contained in:
epriestley 2012-10-23 12:02:40 -07:00
parent 696a1b22ba
commit 6b39af4022

View file

@ -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();
}