1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Set messageIDHash from SendGrid and Test controllers

Summary:
Most mail comes in through the script, but we can also generate it with the test controller or the SendGrid receiver.

In these cases, we produce a `null` message hash ID, which fails on inserts into MySQL databases configured in strict mode.

Instead, correctly generate the hash ID in these cases (for tests, make one up).

Test Plan: Generated test mail. (I'll see if @sokcevic can test SendGrid).

Reviewers: btrahan

Reviewed By: btrahan

CC: sokcevic, aran

Maniphest Tasks: T2423

Differential Revision: https://secure.phabricator.com/D4667
This commit is contained in:
epriestley 2013-01-26 15:22:06 -08:00
parent 3f91559b8a
commit 1670f5841d
2 changed files with 8 additions and 0 deletions

View file

@ -28,6 +28,12 @@ final class PhabricatorMetaMTAReceiveController
array(
'text' => $request->getStr('body'),
));
// Make up some unique value, since this column isn't nullable.
$received->setMessageIDHash(
PhabricatorHash::digestForIndex(
Filesystem::readRandomBytes(12)));
$received->save();
$received->processReceivedMail();

View file

@ -39,6 +39,8 @@ final class PhabricatorMetaMTASendGridReceiveController
'text' => $request->getStr('text'),
'html' => $request->getStr('from'),
));
$received->setMessageIDHash(
PhabricatorHash::digestForIndex($received->getMessageID()));
$file_phids = array();
foreach ($_FILES as $file_raw) {