diff --git a/src/applications/differential/editor/revision/DifferentialRevisionEditor.php b/src/applications/differential/editor/revision/DifferentialRevisionEditor.php index 73bf1999ac..2f012dba41 100644 --- a/src/applications/differential/editor/revision/DifferentialRevisionEditor.php +++ b/src/applications/differential/editor/revision/DifferentialRevisionEditor.php @@ -188,36 +188,24 @@ class DifferentialRevisionEditor { $diff->setRevisionID($revision->getID()); $revision->setLineCount($diff->getLineCount()); -// TODO! -// $revision->setRepositoryID($diff->getRepositoryID()); + $adapter = new HeraldDifferentialRevisionAdapter( + $revision, + $diff); + $adapter->setExplicitCCs($new['ccs']); + $adapter->setExplicitReviewers($new['rev']); + $adapter->setForbiddenCCs($revision->getUnsubscribed()); -/* - $iface = new DifferentialRevisionHeraldable($revision); - $iface->setExplicitCCs($new['ccs']); - $iface->setExplicitReviewers($new['rev']); - $iface->setForbiddenCCs($revision->getForbiddenCCPHIDs()); - $iface->setForbiddenReviewers($revision->getForbiddenReviewers()); - $iface->setDiff($diff); - - $xscript = HeraldEngine::loadAndApplyRules($iface); - $xscript_uri = $xscript->getURI(); + $xscript = HeraldEngine::loadAndApplyRules($adapter); + $xscript_uri = PhabricatorEnv::getProductionURI( + '/herald/transcript/'.$xscript->getID().'/'); $xscript_phid = $xscript->getPHID(); $xscript_header = $xscript->getXHeraldRulesHeader(); - $sub = array( 'rev' => array(), - 'ccs' => $iface->getCCsAddedByHerald(), + 'ccs' => $adapter->getCCsAddedByHerald(), ); - $rem_ccs = $iface->getCCsRemovedByHerald(); -*/ - // TODO! - $sub = array( - 'rev' => array(), - 'ccs' => array(), - ); - - + $rem_ccs = $adapter->getCCsRemovedByHerald(); } else { $sub = array( 'rev' => array(), @@ -260,6 +248,8 @@ class DifferentialRevisionEditor { // TODO: When Herald is brought over, run through this stuff to figure // out which adds are Herald's fault. + // TODO: Still need to do this. + if ($add['ccs'] || $rem['ccs']) { foreach (array_keys($add['ccs']) as $id) { if (empty($new['ccs'][$id])) { @@ -358,10 +348,8 @@ class DifferentialRevisionEditor { 'actor' => $this->getActorPHID(), ); -// TODO: When timelines get implemented, move indexing to them. +// TODO: Move this into a worker task thing. PhabricatorSearchDifferentialIndexer::indexRevision($revision); -// TODO -// id(new ToolsTimelineEvent('difx', fb_json_encode($event)))->record(); if ($this->silentUpdate) { return; @@ -407,9 +395,8 @@ class DifferentialRevisionEditor { } foreach ($mail as $message) { -// TODO -// $message->setHeraldTranscriptURI($xscript_uri); -// $message->setXHeraldRulesHeader($xscript_header); + $message->setHeraldTranscriptURI($xscript_uri); + $message->setXHeraldRulesHeader($xscript_header); $message->send(); } } diff --git a/src/applications/differential/editor/revision/__init__.php b/src/applications/differential/editor/revision/__init__.php index 314d676c81..ad53cc8f87 100644 --- a/src/applications/differential/editor/revision/__init__.php +++ b/src/applications/differential/editor/revision/__init__.php @@ -11,8 +11,11 @@ phutil_require_module('phabricator', 'applications/differential/mail/ccwelcome') phutil_require_module('phabricator', 'applications/differential/mail/newdiff'); phutil_require_module('phabricator', 'applications/differential/storage/comment'); phutil_require_module('phabricator', 'applications/differential/storage/revision'); +phutil_require_module('phabricator', 'applications/herald/adapter/differential'); +phutil_require_module('phabricator', 'applications/herald/engine/engine'); phutil_require_module('phabricator', 'applications/phid/handle/data'); phutil_require_module('phabricator', 'applications/search/index/indexer/differential'); +phutil_require_module('phabricator', 'infrastructure/env'); phutil_require_module('phabricator', 'storage/qsprintf'); phutil_require_module('phabricator', 'storage/queryfx'); diff --git a/src/applications/herald/adapter/differential/HeraldDifferentialRevisionAdapter.php b/src/applications/herald/adapter/differential/HeraldDifferentialRevisionAdapter.php index 318c9a5dbd..b4025a656f 100644 --- a/src/applications/herald/adapter/differential/HeraldDifferentialRevisionAdapter.php +++ b/src/applications/herald/adapter/differential/HeraldDifferentialRevisionAdapter.php @@ -24,7 +24,6 @@ class HeraldDifferentialRevisionAdapter extends HeraldObjectAdapter { protected $explicitCCs; protected $explicitReviewers; protected $forbiddenCCs; - protected $forbiddenReviewers; protected $newCCs = array(); protected $remCCs = array(); @@ -57,11 +56,6 @@ class HeraldDifferentialRevisionAdapter extends HeraldObjectAdapter { return $this; } - public function setForbiddenReviewers($forbidden_reviewers) { - $this->forbiddenReviewers = $forbidden_reviewers; - return $this; - } - public function getCCsAddedByHerald() { return array_diff_key($this->newCCs, $this->remCCs); }