1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02: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))
->setMailAddedParticipantPHIDs($phids)
->setActor($sender)
->setExcludeMailRecipientPHIDs($mail->loadExcludeMailRecipientPHIDs())
->setExcludeMailRecipientPHIDs($mail->loadAllRecipientPHIDs())
->processEmail($mail);
if ($conpherence) {

View file

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

View file

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

View file

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

View file

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

View file

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