Differential D20525 Diff 48949 src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
Show First 20 Lines • Show All 3,042 Lines • ▼ Show 20 Lines | private function buildMailWithRecipients( | ||||
$targets = $this->buildReplyHandler($object) | $targets = $this->buildReplyHandler($object) | ||||
->setUnexpandablePHIDs($unexpandable) | ->setUnexpandablePHIDs($unexpandable) | ||||
->getMailTargets($email_to, $email_cc); | ->getMailTargets($email_to, $email_cc); | ||||
// Set this explicitly before we start swapping out the effective actor. | // Set this explicitly before we start swapping out the effective actor. | ||||
$this->setActingAsPHID($this->getActingAsPHID()); | $this->setActingAsPHID($this->getActingAsPHID()); | ||||
$xaction_phids = mpull($xactions, 'getPHID'); | |||||
$messages = array(); | $messages = array(); | ||||
foreach ($targets as $target) { | foreach ($targets as $target) { | ||||
$original_actor = $this->getActor(); | $original_actor = $this->getActor(); | ||||
$viewer = $target->getViewer(); | $viewer = $target->getViewer(); | ||||
$this->setActor($viewer); | $this->setActor($viewer); | ||||
$locale = PhabricatorEnv::beginScopedLocale($viewer->getTranslation()); | $locale = PhabricatorEnv::beginScopedLocale($viewer->getTranslation()); | ||||
$caught = null; | $caught = null; | ||||
$mail = null; | $mail = null; | ||||
try { | try { | ||||
// Reload handles for the new viewer. | // Reload the transactions for the current viewer. | ||||
$this->loadHandles($xactions); | if ($xaction_phids) { | ||||
$query = PhabricatorApplicationTransactionQuery::newQueryForObject( | |||||
$object); | |||||
$mail_xactions = $query | |||||
->setViewer($viewer) | |||||
->withObjectPHIDs(array($object->getPHID())) | |||||
->withPHIDs($xaction_phids) | |||||
->execute(); | |||||
} else { | |||||
$mail_xactions = array(); | |||||
} | |||||
// Reload handles for the current viewer. This covers older code which | |||||
// emits a list of handle PHIDs upfront. | |||||
$this->loadHandles($mail_xactions); | |||||
$mail = $this->buildMailForTarget($object, $xactions, $target); | $mail = $this->buildMailForTarget($object, $mail_xactions, $target); | ||||
if ($mail) { | if ($mail) { | ||||
if ($this->mustEncrypt) { | if ($this->mustEncrypt) { | ||||
->setMustEncrypt(true) | ->setMustEncrypt(true) | ||||
->setMustEncryptReasons($this->mustEncrypt); | ->setMustEncryptReasons($this->mustEncrypt); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,246 Lines • Show Last 20 Lines |