Differential D13589 Diff 33531 src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php
| Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | if (preg_match('/.+@.+/', $to)) { | ||||
| // look for a receiver which will accept it. | // look for a receiver which will accept it. | ||||
| $pseudohash = PhabricatorObjectMailReceiver::computeMailHash('x', 'y'); | $pseudohash = PhabricatorObjectMailReceiver::computeMailHash('x', 'y'); | ||||
| $pseudomail = id(new PhabricatorMetaMTAReceivedMail()) | $pseudomail = id(new PhabricatorMetaMTAReceivedMail()) | ||||
| ->setHeaders( | ->setHeaders( | ||||
| array( | array( | ||||
| 'to' => $to.'+1+'.$pseudohash, | 'to' => $to.'+1+'.$pseudohash, | ||||
| )); | )); | ||||
| $receivers = id(new PhutilSymbolLoader()) | $receivers = id(new PhutilClassMapQuery()) | ||||
| ->setAncestorClass('PhabricatorMailReceiver') | ->setAncestorClass('PhabricatorMailReceiver') | ||||
| ->loadObjects(); | ->setFilterMethod('isEnabled') | ||||
| ->execute(); | |||||
epriestley: I think this one may also vary across config (e.g., installed vs uninstalled applications). | |||||
| $receiver = null; | $receiver = null; | ||||
| foreach ($receivers as $possible_receiver) { | foreach ($receivers as $possible_receiver) { | ||||
| if (!$possible_receiver->isEnabled()) { | |||||
| continue; | |||||
| } | |||||
| if (!$possible_receiver->canAcceptMail($pseudomail)) { | if (!$possible_receiver->canAcceptMail($pseudomail)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| $receiver = $possible_receiver; | $receiver = $possible_receiver; | ||||
| break; | break; | ||||
| } | } | ||||
| if (!$receiver) { | if (!$receiver) { | ||||
| ▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines | |||||
I think this one may also vary across config (e.g., installed vs uninstalled applications).