de-duplicate emails received by phabricator multiple times

Summary: this can happen if you have Phabricator and email lists co-mingling such that Phabricator receives an email multiple times. we can prevent this from then spamming everyone or otherwise taking the action multiple times by storing a message id hash and dropping the message if we have more than one message that matches.

Test Plan: simulated sending the same email multiple times on the command line. noted only the first one made it through.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1726

Differential Revision: https://secure.phabricator.com/D4328
This commit is contained in:
Bob Trahan
2013-01-03 17:04:30 -08:00
parent f12af03836
commit 3448781c40
4 changed files with 33 additions and 0 deletions

View File

@@ -34,6 +34,9 @@ $received->setBodies(array(
'text' => $text_body,
'html' => $parser->getMessageBody('html'),
));
$received->setMessageIDHash(
PhabricatorHash::digestForIndex($received->getMessageID())
);
$attachments = array();
foreach ($parser->getAttachments() as $attachment) {