1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Add Maniphest Task email creator to CCs

Summary: Fixes T9369.

Test Plan:
  - Sent a mail with Mail.app to `bugs@local.phacility.com`.
  - Used "View Raw Mail", copy-pasted it into `mail.txt` on disk.
  - Ran `cat mail.txt | ./scripts/mail/manage_mail.php --process-duplicates`.
  - Saw task get created and me get added as CC.
  - Changed "To" to include another user, ran command again, saw task get created and other user get added as CC.

Reviewers: chad

Reviewed By: chad

Subscribers: Korvin

Maniphest Tasks: T9369

Differential Revision: https://secure.phabricator.com/D14086
This commit is contained in:
epriestley 2015-09-09 14:07:07 -07:00
parent 345cc66f0f
commit de01f3e2e0
6 changed files with 21 additions and 10 deletions

View file

@ -56,7 +56,7 @@ final class ConpherenceCreateThreadMailReceiver
->setMailReceiver(ConpherenceThread::initializeNewRoom($sender)) ->setMailReceiver(ConpherenceThread::initializeNewRoom($sender))
->setMailAddedParticipantPHIDs($phids) ->setMailAddedParticipantPHIDs($phids)
->setActor($sender) ->setActor($sender)
->setExcludeMailRecipientPHIDs($mail->loadExcludeMailRecipientPHIDs()) ->setExcludeMailRecipientPHIDs($mail->loadAllRecipientPHIDs())
->processEmail($mail); ->processEmail($mail);
if ($conpherence) { if ($conpherence) {

View file

@ -24,7 +24,7 @@ final class ManiphestCreateMailReceiver extends PhabricatorMailReceiver {
$handler->setActor($sender); $handler->setActor($sender);
$handler->setExcludeMailRecipientPHIDs( $handler->setExcludeMailRecipientPHIDs(
$mail->loadExcludeMailRecipientPHIDs()); $mail->loadAllRecipientPHIDs());
if ($this->getApplicationEmail()) { if ($this->getApplicationEmail()) {
$handler->setApplicationEmail($this->getApplicationEmail()); $handler->setApplicationEmail($this->getApplicationEmail());
} }

View file

@ -19,17 +19,28 @@ final class ManiphestReplyHandler
$object = $this->getMailReceiver(); $object = $this->getMailReceiver();
$is_new = !$object->getID(); $is_new = !$object->getID();
$actor = $this->getActor();
$xactions = array(); $xactions = array();
if ($is_new) { if ($is_new) {
$xactions[] = $object->getApplicationTransactionTemplate() $xactions[] = $this->newTransaction()
->setTransactionType(ManiphestTransaction::TYPE_TITLE) ->setTransactionType(ManiphestTransaction::TYPE_TITLE)
->setNewValue(nonempty($mail->getSubject(), pht('Untitled Task'))); ->setNewValue(nonempty($mail->getSubject(), pht('Untitled Task')));
$xactions[] = $object->getApplicationTransactionTemplate() $xactions[] = $this->newTransaction()
->setTransactionType(ManiphestTransaction::TYPE_DESCRIPTION) ->setTransactionType(ManiphestTransaction::TYPE_DESCRIPTION)
->setNewValue($body); ->setNewValue($body);
$actor_phid = $actor->getPHID();
if ($actor_phid) {
$xactions[] = $this->newTransaction()
->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
->setNewValue(
array(
'+' => array($actor_phid),
));
}
} }
return $xactions; return $xactions;

View file

@ -49,7 +49,7 @@ abstract class PhabricatorObjectMailReceiver extends PhabricatorMailReceiver {
return $handler return $handler
->setMailReceiver($object) ->setMailReceiver($object)
->setActor($sender) ->setActor($sender)
->setExcludeMailRecipientPHIDs($mail->loadExcludeMailRecipientPHIDs()) ->setExcludeMailRecipientPHIDs($mail->loadAllRecipientPHIDs())
->processEmail($mail); ->processEmail($mail);
} }

View file

@ -82,7 +82,7 @@ final class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO {
return $this->getRawEmailAddresses(idx($this->headers, 'to')); return $this->getRawEmailAddresses(idx($this->headers, 'to'));
} }
public function loadExcludeMailRecipientPHIDs() { public function loadAllRecipientPHIDs() {
$addresses = array_merge( $addresses = array_merge(
$this->getToAddresses(), $this->getToAddresses(),
$this->getCCAddresses()); $this->getCCAddresses());

View file

@ -39,7 +39,7 @@ abstract class PhabricatorApplicationTransactionReplyHandler
return $editor; return $editor;
} }
private function newTransaction() { protected function newTransaction() {
return $this->getMailReceiver()->getApplicationTransactionTemplate(); return $this->getMailReceiver()->getApplicationTransactionTemplate();
} }
@ -80,15 +80,15 @@ abstract class PhabricatorApplicationTransactionReplyHandler
$xactions = $this->didReceiveMail($mail, $body); $xactions = $this->didReceiveMail($mail, $body);
// If this object is subscribable, subscribe all the users who were // If this object is subscribable, subscribe all the users who were
// CC'd on the message. // recipients on the message.
if ($object instanceof PhabricatorSubscribableInterface) { if ($object instanceof PhabricatorSubscribableInterface) {
$subscriber_phids = $mail->loadCCPHIDs(); $subscriber_phids = $mail->loadAllRecipientPHIDs();
if ($subscriber_phids) { if ($subscriber_phids) {
$xactions[] = $this->newTransaction() $xactions[] = $this->newTransaction()
->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS) ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
->setNewValue( ->setNewValue(
array( array(
'+' => array($viewer->getPHID()), '+' => $subscriber_phids,
)); ));
} }
} }