Page MenuHomePhabricator

D14997.id36229.diff
No OneTemporary

D14997.id36229.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -257,7 +257,6 @@
'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 @@
'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
--- a/src/applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-final class ConpherenceCreateThreadMailReceiver
- extends PhabricatorMailReceiver {
-
- public function isEnabled() {
- $app_class = 'PhabricatorConpherenceApplication';
- return PhabricatorApplication::isClassInstalled($app_class);
- }
-
- public function canAcceptMail(PhabricatorMetaMTAReceivedMail $mail) {
- $usernames = $this->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());
- }
- }
-
-}

File Metadata

Mime Type
text/plain
Expires
Fri, May 10, 2:27 AM (4 w, 5 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6281389
Default Alt Text
D14997.id36229.diff (3 KB)

Event Timeline