Differential D19021 Diff 45616 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 71 Lines • ▼ Show 20 Lines | abstract class PhabricatorApplicationTransactionEditor | ||||
private $modularTypes; | private $modularTypes; | ||||
private $silent; | private $silent; | ||||
private $mustEncrypt; | private $mustEncrypt; | ||||
private $stampTemplates = array(); | private $stampTemplates = array(); | ||||
private $mailStamps = array(); | private $mailStamps = array(); | ||||
private $oldTo = array(); | private $oldTo = array(); | ||||
private $oldCC = array(); | private $oldCC = array(); | ||||
private $mailRemovedPHIDs = array(); | private $mailRemovedPHIDs = array(); | ||||
private $mailUnexpandablePHIDs = array(); | |||||
private $transactionQueue = array(); | private $transactionQueue = array(); | ||||
const STORAGE_ENCODING_BINARY = 'binary'; | const STORAGE_ENCODING_BINARY = 'binary'; | ||||
/** | /** | ||||
* Get the class name for the application this editor is a part of. | * Get the class name for the application this editor is a part of. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 1,111 Lines • ▼ Show 20 Lines | final public function applyTransactions( | ||||
// Editors need to pass into workers. | // Editors need to pass into workers. | ||||
$object = $this->willPublish($object, $xactions); | $object = $this->willPublish($object, $xactions); | ||||
if (!$this->getIsSilent()) { | if (!$this->getIsSilent()) { | ||||
if ($this->shouldSendMail($object, $xactions)) { | if ($this->shouldSendMail($object, $xactions)) { | ||||
$this->mailShouldSend = true; | $this->mailShouldSend = true; | ||||
$this->mailToPHIDs = $this->getMailTo($object); | $this->mailToPHIDs = $this->getMailTo($object); | ||||
$this->mailCCPHIDs = $this->getMailCC($object); | $this->mailCCPHIDs = $this->getMailCC($object); | ||||
$this->mailUnexpandablePHIDs = $this->newMailUnexpandablePHIDs($object); | |||||
// Add any recipients who were previously on the notification list | // Add any recipients who were previously on the notification list | ||||
// but were removed by this change. | // but were removed by this change. | ||||
$this->applyOldRecipientLists(); | $this->applyOldRecipientLists(); | ||||
$mail_xactions = $this->getTransactionsForMail($object, $xactions); | $mail_xactions = $this->getTransactionsForMail($object, $xactions); | ||||
$stamps = $this->newMailStamps($object, $xactions); | $stamps = $this->newMailStamps($object, $xactions); | ||||
foreach ($stamps as $stamp) { | foreach ($stamps as $stamp) { | ||||
▲ Show 20 Lines • Show All 1,342 Lines • ▼ Show 20 Lines | /* -( Sending Mail )------------------------------------------------------- */ | ||||
private function buildMail( | private function buildMail( | ||||
PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
array $xactions) { | array $xactions) { | ||||
$email_to = $this->mailToPHIDs; | $email_to = $this->mailToPHIDs; | ||||
$email_cc = $this->mailCCPHIDs; | $email_cc = $this->mailCCPHIDs; | ||||
$email_cc = array_merge($email_cc, $this->heraldEmailPHIDs); | $email_cc = array_merge($email_cc, $this->heraldEmailPHIDs); | ||||
$unexpandable = $this->mailUnexpandablePHIDs; | |||||
if (!is_array($unexpandable)) { | |||||
$unexpandable = array(); | |||||
} | |||||
$targets = $this->buildReplyHandler($object) | $targets = $this->buildReplyHandler($object) | ||||
->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()); | ||||
$messages = array(); | $messages = array(); | ||||
foreach ($targets as $target) { | foreach ($targets as $target) { | ||||
$original_actor = $this->getActor(); | $original_actor = $this->getActor(); | ||||
▲ Show 20 Lines • Show All 238 Lines • ▼ Show 20 Lines | /* -( Sending Mail )------------------------------------------------------- */ | ||||
/** | /** | ||||
* @task mail | * @task mail | ||||
*/ | */ | ||||
protected function getMailTo(PhabricatorLiskDAO $object) { | protected function getMailTo(PhabricatorLiskDAO $object) { | ||||
throw new Exception(pht('Capability not supported.')); | throw new Exception(pht('Capability not supported.')); | ||||
} | } | ||||
protected function newMailUnexpandablePHIDs(PhabricatorLiskDAO $object) { | |||||
return array(); | |||||
} | |||||
/** | /** | ||||
* @task mail | * @task mail | ||||
*/ | */ | ||||
protected function getMailCC(PhabricatorLiskDAO $object) { | protected function getMailCC(PhabricatorLiskDAO $object) { | ||||
$phids = array(); | $phids = array(); | ||||
$has_support = false; | $has_support = false; | ||||
if ($object instanceof PhabricatorSubscribableInterface) { | if ($object instanceof PhabricatorSubscribableInterface) { | ||||
▲ Show 20 Lines • Show All 784 Lines • ▼ Show 20 Lines | return array( | ||||
'mailToPHIDs', | 'mailToPHIDs', | ||||
'mailCCPHIDs', | 'mailCCPHIDs', | ||||
'feedNotifyPHIDs', | 'feedNotifyPHIDs', | ||||
'feedRelatedPHIDs', | 'feedRelatedPHIDs', | ||||
'feedShouldPublish', | 'feedShouldPublish', | ||||
'mailShouldSend', | 'mailShouldSend', | ||||
'mustEncrypt', | 'mustEncrypt', | ||||
'mailStamps', | 'mailStamps', | ||||
'mailUnexpandablePHIDs', | |||||
); | ); | ||||
} | } | ||||
/** | /** | ||||
* Apply encodings prior to storage. | * Apply encodings prior to storage. | ||||
* | * | ||||
* See @{method:getCustomWorkerStateEncoding}. | * See @{method:getCustomWorkerStateEncoding}. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 573 Lines • Show Last 20 Lines |