@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove "username@phabricator.mycompany.com" creating a Conpherence

Summary:
Ref T10121. This doesn't work at all at HEAD, and even when it did it was mostly just confusing to installs with unexpected setups where Phabricator is receiving mail at `@mycompany.com` and this is colliding with real addresses.

It might make sense to restore it some day after the next Conphernece update, but just strip it out for now. Since it doesn't work anyway, I'm pretty confident no one is using it.

Test Plan:
- Before patch: send mail to `dog@local.phacility.com`, got a policy error from Conpherece.
- After patch: sent mail to `dog@local.phacility.com`, got a correct "no routable recipients" error.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10121

Differential Revision: https://secure.phabricator.com/D14997

-69
-2
src/__phutil_library_map__.php
··· 257 257 'ConpherenceConstants' => 'applications/conpherence/constants/ConpherenceConstants.php', 258 258 'ConpherenceController' => 'applications/conpherence/controller/ConpherenceController.php', 259 259 'ConpherenceCreateThreadConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php', 260 - 'ConpherenceCreateThreadMailReceiver' => 'applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php', 261 260 'ConpherenceDAO' => 'applications/conpherence/storage/ConpherenceDAO.php', 262 261 'ConpherenceDurableColumnView' => 'applications/conpherence/view/ConpherenceDurableColumnView.php', 263 262 'ConpherenceEditor' => 'applications/conpherence/editor/ConpherenceEditor.php', ··· 4193 4192 'ConpherenceConstants' => 'Phobject', 4194 4193 'ConpherenceController' => 'PhabricatorController', 4195 4194 'ConpherenceCreateThreadConduitAPIMethod' => 'ConpherenceConduitAPIMethod', 4196 - 'ConpherenceCreateThreadMailReceiver' => 'PhabricatorMailReceiver', 4197 4195 'ConpherenceDAO' => 'PhabricatorLiskDAO', 4198 4196 'ConpherenceDurableColumnView' => 'AphrontTagView', 4199 4197 'ConpherenceEditor' => 'PhabricatorApplicationTransactionEditor',
-67
src/applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php
··· 1 - <?php 2 - 3 - final class ConpherenceCreateThreadMailReceiver 4 - extends PhabricatorMailReceiver { 5 - 6 - public function isEnabled() { 7 - $app_class = 'PhabricatorConpherenceApplication'; 8 - return PhabricatorApplication::isClassInstalled($app_class); 9 - } 10 - 11 - public function canAcceptMail(PhabricatorMetaMTAReceivedMail $mail) { 12 - $usernames = $this->getMailUsernames($mail); 13 - if (!$usernames) { 14 - return false; 15 - } 16 - 17 - $users = $this->loadMailUsers($mail); 18 - if (count($users) != count($usernames)) { 19 - // At least some of the addresses are not users, so don't accept this as 20 - // a new Conpherence thread. 21 - return false; 22 - } 23 - 24 - return true; 25 - } 26 - 27 - private function getMailUsernames(PhabricatorMetaMTAReceivedMail $mail) { 28 - $usernames = array(); 29 - foreach ($mail->getToAddresses() as $to_address) { 30 - $address = self::stripMailboxPrefix($to_address); 31 - $usernames[] = id(new PhutilEmailAddress($address))->getLocalPart(); 32 - } 33 - 34 - return array_unique($usernames); 35 - } 36 - 37 - private function loadMailUsers(PhabricatorMetaMTAReceivedMail $mail) { 38 - $usernames = $this->getMailUsernames($mail); 39 - if (!$usernames) { 40 - return array(); 41 - } 42 - 43 - return id(new PhabricatorUser())->loadAllWhere( 44 - 'username in (%Ls)', 45 - $usernames); 46 - } 47 - 48 - protected function processReceivedMail( 49 - PhabricatorMetaMTAReceivedMail $mail, 50 - PhabricatorUser $sender) { 51 - 52 - $users = $this->loadMailUsers($mail); 53 - $phids = mpull($users, 'getPHID'); 54 - 55 - $conpherence = id(new ConpherenceReplyHandler()) 56 - ->setMailReceiver(ConpherenceThread::initializeNewRoom($sender)) 57 - ->setMailAddedParticipantPHIDs($phids) 58 - ->setActor($sender) 59 - ->setExcludeMailRecipientPHIDs($mail->loadAllRecipientPHIDs()) 60 - ->processEmail($mail); 61 - 62 - if ($conpherence) { 63 - $mail->setRelatedPHID($conpherence->getPHID()); 64 - } 65 - } 66 - 67 - }