diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 1782d3dbcb..8a59bcf08e 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -257,7 +257,6 @@ phutil_register_library_map(array( 'ConpherenceConstants' => 'applications/conpherence/constants/ConpherenceConstants.php', 'ConpherenceController' => 'applications/conpherence/controller/ConpherenceController.php', 'ConpherenceCreateThreadConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php', - 'ConpherenceCreateThreadMailReceiver' => 'applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php', 'ConpherenceDAO' => 'applications/conpherence/storage/ConpherenceDAO.php', 'ConpherenceDurableColumnView' => 'applications/conpherence/view/ConpherenceDurableColumnView.php', 'ConpherenceEditor' => 'applications/conpherence/editor/ConpherenceEditor.php', @@ -4193,7 +4192,6 @@ phutil_register_library_map(array( 'ConpherenceConstants' => 'Phobject', 'ConpherenceController' => 'PhabricatorController', 'ConpherenceCreateThreadConduitAPIMethod' => 'ConpherenceConduitAPIMethod', - 'ConpherenceCreateThreadMailReceiver' => 'PhabricatorMailReceiver', 'ConpherenceDAO' => 'PhabricatorLiskDAO', 'ConpherenceDurableColumnView' => 'AphrontTagView', 'ConpherenceEditor' => 'PhabricatorApplicationTransactionEditor', diff --git a/src/applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php b/src/applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php deleted file mode 100644 index 543233df6e..0000000000 --- a/src/applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php +++ /dev/null @@ -1,67 +0,0 @@ -getMailUsernames($mail); - if (!$usernames) { - return false; - } - - $users = $this->loadMailUsers($mail); - if (count($users) != count($usernames)) { - // At least some of the addresses are not users, so don't accept this as - // a new Conpherence thread. - return false; - } - - return true; - } - - private function getMailUsernames(PhabricatorMetaMTAReceivedMail $mail) { - $usernames = array(); - foreach ($mail->getToAddresses() as $to_address) { - $address = self::stripMailboxPrefix($to_address); - $usernames[] = id(new PhutilEmailAddress($address))->getLocalPart(); - } - - return array_unique($usernames); - } - - private function loadMailUsers(PhabricatorMetaMTAReceivedMail $mail) { - $usernames = $this->getMailUsernames($mail); - if (!$usernames) { - return array(); - } - - return id(new PhabricatorUser())->loadAllWhere( - 'username in (%Ls)', - $usernames); - } - - protected function processReceivedMail( - PhabricatorMetaMTAReceivedMail $mail, - PhabricatorUser $sender) { - - $users = $this->loadMailUsers($mail); - $phids = mpull($users, 'getPHID'); - - $conpherence = id(new ConpherenceReplyHandler()) - ->setMailReceiver(ConpherenceThread::initializeNewRoom($sender)) - ->setMailAddedParticipantPHIDs($phids) - ->setActor($sender) - ->setExcludeMailRecipientPHIDs($mail->loadAllRecipientPHIDs()) - ->processEmail($mail); - - if ($conpherence) { - $mail->setRelatedPHID($conpherence->getPHID()); - } - } - -}