Differential D18881 Diff 45292 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 53 Lines • ▼ Show 20 Lines | abstract class PhabricatorApplicationTransactionEditor | ||||
private $subscribers; | private $subscribers; | ||||
private $unmentionablePHIDMap = array(); | private $unmentionablePHIDMap = array(); | ||||
private $applicationEmail; | private $applicationEmail; | ||||
private $isPreview; | private $isPreview; | ||||
private $isHeraldEditor; | private $isHeraldEditor; | ||||
private $isInverseEdgeEditor; | private $isInverseEdgeEditor; | ||||
private $actingAsPHID; | private $actingAsPHID; | ||||
private $disableEmail; | |||||
private $heraldEmailPHIDs = array(); | private $heraldEmailPHIDs = array(); | ||||
private $heraldForcedEmailPHIDs = array(); | private $heraldForcedEmailPHIDs = array(); | ||||
private $heraldHeader; | private $heraldHeader; | ||||
private $mailToPHIDs = array(); | private $mailToPHIDs = array(); | ||||
private $mailCCPHIDs = array(); | private $mailCCPHIDs = array(); | ||||
private $feedNotifyPHIDs = array(); | private $feedNotifyPHIDs = array(); | ||||
private $feedRelatedPHIDs = array(); | private $feedRelatedPHIDs = array(); | ||||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | public function setIsHeraldEditor($is_herald_editor) { | ||||
$this->isHeraldEditor = $is_herald_editor; | $this->isHeraldEditor = $is_herald_editor; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getIsHeraldEditor() { | public function getIsHeraldEditor() { | ||||
return $this->isHeraldEditor; | return $this->isHeraldEditor; | ||||
} | } | ||||
/** | |||||
* Prevent this editor from generating email when applying transactions. | |||||
* | |||||
* @param bool True to disable email. | |||||
* @return this | |||||
*/ | |||||
public function setDisableEmail($disable_email) { | |||||
$this->disableEmail = $disable_email; | |||||
return $this; | |||||
} | |||||
public function getDisableEmail() { | |||||
return $this->disableEmail; | |||||
} | |||||
public function setUnmentionablePHIDMap(array $map) { | public function setUnmentionablePHIDMap(array $map) { | ||||
$this->unmentionablePHIDMap = $map; | $this->unmentionablePHIDMap = $map; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getUnmentionablePHIDMap() { | public function getUnmentionablePHIDMap() { | ||||
return $this->unmentionablePHIDMap; | return $this->unmentionablePHIDMap; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 915 Lines • ▼ Show 20 Lines | final public function applyTransactions( | ||||
// exists right now. The worker may not execute for some time, and we want | // exists right now. The worker may not execute for some time, and we want | ||||
// to use the current To/CC list, not respect any changes which may occur | // to use the current To/CC list, not respect any changes which may occur | ||||
// between now and when the worker executes. | // between now and when the worker executes. | ||||
// | // | ||||
// As a secondary benefit, this tends to reduce the amount of state that | // As a secondary benefit, this tends to reduce the amount of state that | ||||
// Editors need to pass into workers. | // Editors need to pass into workers. | ||||
$object = $this->willPublish($object, $xactions); | $object = $this->willPublish($object, $xactions); | ||||
if (!$this->getDisableEmail()) { | |||||
if ($this->shouldSendMail($object, $xactions)) { | if ($this->shouldSendMail($object, $xactions)) { | ||||
$this->mailToPHIDs = $this->getMailTo($object); | $this->mailToPHIDs = $this->getMailTo($object); | ||||
$this->mailCCPHIDs = $this->getMailCC($object); | $this->mailCCPHIDs = $this->getMailCC($object); | ||||
} | } | ||||
} | |||||
if ($this->shouldPublishFeedStory($object, $xactions)) { | if ($this->shouldPublishFeedStory($object, $xactions)) { | ||||
$this->feedShouldPublish = true; | $this->feedShouldPublish = true; | ||||
$this->feedRelatedPHIDs = $this->getFeedRelatedPHIDs($object, $xactions); | $this->feedRelatedPHIDs = $this->getFeedRelatedPHIDs($object, $xactions); | ||||
$this->feedNotifyPHIDs = $this->getFeedNotifyPHIDs($object, $xactions); | $this->feedNotifyPHIDs = $this->getFeedNotifyPHIDs($object, $xactions); | ||||
} | } | ||||
PhabricatorWorker::scheduleTask( | PhabricatorWorker::scheduleTask( | ||||
Show All 30 Lines | public function publishTransactions( | ||||
// Hook for edges or other properties that may need (re-)loading | // Hook for edges or other properties that may need (re-)loading | ||||
$object = $this->willPublish($object, $xactions); | $object = $this->willPublish($object, $xactions); | ||||
// The object might have changed, so reassign it. | // The object might have changed, so reassign it. | ||||
$this->object = $object; | $this->object = $object; | ||||
$messages = array(); | $messages = array(); | ||||
if (!$this->getDisableEmail()) { | |||||
if ($this->shouldSendMail($object, $xactions)) { | if ($this->shouldSendMail($object, $xactions)) { | ||||
$messages = $this->buildMail($object, $xactions); | $messages = $this->buildMail($object, $xactions); | ||||
} | } | ||||
} | |||||
if ($this->supportsSearch()) { | if ($this->supportsSearch()) { | ||||
PhabricatorSearchWorker::queueDocumentForIndexing( | PhabricatorSearchWorker::queueDocumentForIndexing( | ||||
$object->getPHID(), | $object->getPHID(), | ||||
array( | array( | ||||
'transactionPHIDs' => mpull($xactions, 'getPHID'), | 'transactionPHIDs' => mpull($xactions, 'getPHID'), | ||||
)); | )); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,279 Lines • ▼ Show 20 Lines | /* -( Workers )------------------------------------------------------------ */ | ||||
* the worker. | * the worker. | ||||
* | * | ||||
* @return list<string> List of properties. | * @return list<string> List of properties. | ||||
* @task workers | * @task workers | ||||
*/ | */ | ||||
private function getAutomaticStateProperties() { | private function getAutomaticStateProperties() { | ||||
return array( | return array( | ||||
'parentMessageID', | 'parentMessageID', | ||||
'disableEmail', | |||||
'isNewObject', | 'isNewObject', | ||||
'heraldEmailPHIDs', | 'heraldEmailPHIDs', | ||||
'heraldForcedEmailPHIDs', | 'heraldForcedEmailPHIDs', | ||||
'heraldHeader', | 'heraldHeader', | ||||
'mailToPHIDs', | 'mailToPHIDs', | ||||
'mailCCPHIDs', | 'mailCCPHIDs', | ||||
'feedNotifyPHIDs', | 'feedNotifyPHIDs', | ||||
'feedRelatedPHIDs', | 'feedRelatedPHIDs', | ||||
▲ Show 20 Lines • Show All 393 Lines • Show Last 20 Lines |