diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php --- a/src/applications/herald/adapter/HeraldAdapter.php +++ b/src/applications/herald/adapter/HeraldAdapter.php @@ -29,6 +29,7 @@ private $contentSource; private $isNewObject; private $applicationEmail; + private $appliedTransactions = array(); private $queuedTransactions = array(); private $emailPHIDs = array(); private $forcedEmailPHIDs = array(); @@ -121,6 +122,36 @@ return !empty($applications); } + + /** + * Set the list of transactions which just took effect. + * + * These transactions are set by @{class:PhabricatorApplicationEditor} + * automatically, before it invokes Herald. + * + * @param list List of transactions. + * @return this + */ + final public function setAppliedTransactions(array $xactions) { + assert_instances_of($xactions, 'PhabricatorApplicationTransaction'); + $this->appliedTransactions = $xactions; + return $this; + } + + + /** + * Get a list of transactions which just took effect. + * + * When an object is edited normally, transactions are applied and then + * Herald executes. You can call this method to examine the transactions + * if you want to react to them. + * + * @return list List of transactions. + */ + final public function getAppliedTransactions() { + return $this->appliedTransactions; + } + public function queueTransaction($transaction) { $this->queuedTransactions[] = $transaction; } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -2867,12 +2867,15 @@ PhabricatorLiskDAO $object, array $xactions) { - $adapter = $this->buildHeraldAdapter($object, $xactions); - $adapter->setContentSource($this->getContentSource()); - $adapter->setIsNewObject($this->getIsNewObject()); + $adapter = $this->buildHeraldAdapter($object, $xactions) + ->setContentSource($this->getContentSource()) + ->setIsNewObject($this->getIsNewObject()) + ->setAppliedTransactions($xactions); + if ($this->getApplicationEmail()) { $adapter->setApplicationEmail($this->getApplicationEmail()); } + $xscript = HeraldEngine::loadAndApplyRules($adapter); $this->setHeraldAdapter($adapter);