Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
Show All 19 Lines | final class PhabricatorMetaMTAMail | ||||
protected $message; | protected $message; | ||||
protected $relatedPHID; | protected $relatedPHID; | ||||
private $recipientExpansionMap; | private $recipientExpansionMap; | ||||
public function __construct() { | public function __construct() { | ||||
$this->status = self::STATUS_QUEUE; | $this->status = self::STATUS_QUEUE; | ||||
$this->parameters = array(); | $this->parameters = array('sensitive' => true); | ||||
parent::__construct(); | parent::__construct(); | ||||
} | } | ||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
self::CONFIG_SERIALIZATION => array( | self::CONFIG_SERIALIZATION => array( | ||||
▲ Show 20 Lines • Show All 220 Lines • ▼ Show 20 Lines | public function setVarySubjectPrefix($prefix) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setBody($body) { | public function setBody($body) { | ||||
$this->setParam('body', $body); | $this->setParam('body', $body); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setSensitiveContent($bool) { | |||||
$this->setParam('sensitive', $bool); | |||||
return $this; | |||||
} | |||||
public function hasSensitiveContent() { | |||||
return $this->getParam('sensitive', true); | |||||
} | |||||
public function setHTMLBody($html) { | public function setHTMLBody($html) { | ||||
$this->setParam('html-body', $html); | $this->setParam('html-body', $html); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getBody() { | public function getBody() { | ||||
return $this->getParam('body'); | return $this->getParam('body'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | public function save() { | ||||
$this->openTransaction(); | $this->openTransaction(); | ||||
// Save to generate a mail ID and PHID. | // Save to generate a mail ID and PHID. | ||||
$result = parent::save(); | $result = parent::save(); | ||||
// Write the recipient edges. | // Write the recipient edges. | ||||
$editor = new PhabricatorEdgeEditor(); | $editor = new PhabricatorEdgeEditor(); | ||||
$edge_type = PhabricatorMetaMTAMailHasRecipientEdgeType::EDGECONST; | $edge_type = PhabricatorMetaMTAMailHasRecipientEdgeType::EDGECONST; | ||||
$actor_phids = array_unique(array_merge( | $recipient_phids = array_merge( | ||||
$this->getAllActorPHIDs(), | $this->getToPHIDs(), | ||||
$this->getExpandedRecipientPHIDs())); | $this->getCcPHIDs()); | ||||
foreach ($actor_phids as $actor_phid) { | $expanded_phids = $this->expandRecipients($recipient_phids); | ||||
$editor->addEdge($this->getPHID(), $edge_type, $actor_phid); | $all_phids = array_unique(array_merge( | ||||
$recipient_phids, | |||||
$expanded_phids)); | |||||
foreach ($all_phids as $curr_phid) { | |||||
$editor->addEdge($this->getPHID(), $edge_type, $curr_phid); | |||||
} | } | ||||
$editor->save(); | $editor->save(); | ||||
// Queue a task to send this mail. | // Queue a task to send this mail. | ||||
$mailer_task = PhabricatorWorker::scheduleTask( | $mailer_task = PhabricatorWorker::scheduleTask( | ||||
'PhabricatorMetaMTAWorker', | 'PhabricatorMetaMTAWorker', | ||||
$this->getID(), | $this->getID(), | ||||
array( | array( | ||||
▲ Show 20 Lines • Show All 666 Lines • Show Last 20 Lines |