Differential D13897 Diff 33570 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 1,049 Lines • ▼ Show 20 Lines | public function publishTransactions( | ||||
if ($this->supportsSearch()) { | if ($this->supportsSearch()) { | ||||
id(new PhabricatorSearchIndexer()) | id(new PhabricatorSearchIndexer()) | ||||
->queueDocumentForIndexing( | ->queueDocumentForIndexing( | ||||
$object->getPHID(), | $object->getPHID(), | ||||
$this->getSearchContextParameter($object, $xactions)); | $this->getSearchContextParameter($object, $xactions)); | ||||
} | } | ||||
if ($this->shouldPublishFeedStory($object, $xactions)) { | if ($this->shouldPublishFeedStory($object, $xactions)) { | ||||
$mailed = array(); | $mailed = array(); | ||||
foreach ($messages as $mail) { | foreach ($messages as $mail) { | ||||
foreach ($mail->buildRecipientList() as $phid) { | foreach ($mail->buildRecipientList() as $phid) { | ||||
$mailed[$phid] = $phid; | $mailed[$phid] = $phid; | ||||
} | } | ||||
} | } | ||||
$this->publishFeedStory($object, $xactions, $mailed); | $this->publishFeedStory($object, $xactions, $mailed); | ||||
▲ Show 20 Lines • Show All 1,228 Lines • ▼ Show 20 Lines | foreach ($targets as $target) { | ||||
throw $ex; | throw $ex; | ||||
} | } | ||||
if ($mail) { | if ($mail) { | ||||
$messages[] = $mail; | $messages[] = $mail; | ||||
} | } | ||||
} | } | ||||
$this->runHeraldMailRules($messages); | |||||
return $messages; | return $messages; | ||||
} | } | ||||
private function buildMailForTarget( | private function buildMailForTarget( | ||||
PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
array $xactions, | array $xactions, | ||||
PhabricatorMailTarget $target) { | PhabricatorMailTarget $target) { | ||||
▲ Show 20 Lines • Show All 825 Lines • ▼ Show 20 Lines | return array( | ||||
'heraldHeader', | 'heraldHeader', | ||||
'mailToPHIDs', | 'mailToPHIDs', | ||||
'mailCCPHIDs', | 'mailCCPHIDs', | ||||
'feedNotifyPHIDs', | 'feedNotifyPHIDs', | ||||
'feedRelatedPHIDs', | 'feedRelatedPHIDs', | ||||
); | ); | ||||
} | } | ||||
private function runHeraldMailRules(array $messages) { | |||||
foreach ($messages as $message) { | |||||
$engine = new HeraldEngine(); | |||||
$adapter = id(new PhabricatorMailOutboundMailHeraldAdapter()) | |||||
->setObject($message); | |||||
$rules = $engine->loadRulesForAdapter($adapter); | |||||
$effects = $engine->applyRules($rules, $adapter); | |||||
$engine->applyEffects($effects, $adapter, $rules); | |||||
} | |||||
} | |||||
} | } |