Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
| Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | try { | ||||
| $this->dropMailAlreadyReceived(); | $this->dropMailAlreadyReceived(); | ||||
| $receiver = $this->loadReceiver(); | $receiver = $this->loadReceiver(); | ||||
| $sender = $receiver->loadSender($this); | $sender = $receiver->loadSender($this); | ||||
| $receiver->validateSender($this, $sender); | $receiver->validateSender($this, $sender); | ||||
| $this->setAuthorPHID($sender->getPHID()); | $this->setAuthorPHID($sender->getPHID()); | ||||
| // Now that we've identified the sender, mark them as the author of | |||||
| // any attached files. | |||||
| $attachments = $this->getAttachments(); | |||||
| if ($attachments) { | |||||
| $files = id(new PhabricatorFileQuery()) | |||||
| ->setViewer(PhabricatorUser::getOmnipotentUser()) | |||||
| ->withPHIDs($attachments) | |||||
| ->execute(); | |||||
| foreach ($files as $file) { | |||||
| $file->setAuthorPHID($sender->getPHID())->save(); | |||||
| } | |||||
| } | |||||
| $receiver->receiveMail($this, $sender); | $receiver->receiveMail($this, $sender); | ||||
| } catch (PhabricatorMetaMTAReceivedMailProcessingException $ex) { | } catch (PhabricatorMetaMTAReceivedMailProcessingException $ex) { | ||||
| switch ($ex->getStatusCode()) { | switch ($ex->getStatusCode()) { | ||||
| case MetaMTAReceivedMailStatus::STATUS_DUPLICATE: | case MetaMTAReceivedMailStatus::STATUS_DUPLICATE: | ||||
| case MetaMTAReceivedMailStatus::STATUS_FROM_PHABRICATOR: | case MetaMTAReceivedMailStatus::STATUS_FROM_PHABRICATOR: | ||||
| // Don't send an error email back in these cases, since they're | // Don't send an error email back in these cases, since they're | ||||
| // very unlikely to be the sender's fault. | // very unlikely to be the sender's fault. | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 229 Lines • Show Last 20 Lines | |||||