mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Reintegrate Herald with Differential.
This commit is contained in:
parent
5e9d053f8e
commit
68687a059a
3 changed files with 19 additions and 35 deletions
|
@ -188,36 +188,24 @@ class DifferentialRevisionEditor {
|
||||||
$diff->setRevisionID($revision->getID());
|
$diff->setRevisionID($revision->getID());
|
||||||
$revision->setLineCount($diff->getLineCount());
|
$revision->setLineCount($diff->getLineCount());
|
||||||
|
|
||||||
// TODO!
|
$adapter = new HeraldDifferentialRevisionAdapter(
|
||||||
// $revision->setRepositoryID($diff->getRepositoryID());
|
$revision,
|
||||||
|
$diff);
|
||||||
|
$adapter->setExplicitCCs($new['ccs']);
|
||||||
|
$adapter->setExplicitReviewers($new['rev']);
|
||||||
|
$adapter->setForbiddenCCs($revision->getUnsubscribed());
|
||||||
|
|
||||||
/*
|
$xscript = HeraldEngine::loadAndApplyRules($adapter);
|
||||||
$iface = new DifferentialRevisionHeraldable($revision);
|
$xscript_uri = PhabricatorEnv::getProductionURI(
|
||||||
$iface->setExplicitCCs($new['ccs']);
|
'/herald/transcript/'.$xscript->getID().'/');
|
||||||
$iface->setExplicitReviewers($new['rev']);
|
|
||||||
$iface->setForbiddenCCs($revision->getForbiddenCCPHIDs());
|
|
||||||
$iface->setForbiddenReviewers($revision->getForbiddenReviewers());
|
|
||||||
$iface->setDiff($diff);
|
|
||||||
|
|
||||||
$xscript = HeraldEngine::loadAndApplyRules($iface);
|
|
||||||
$xscript_uri = $xscript->getURI();
|
|
||||||
$xscript_phid = $xscript->getPHID();
|
$xscript_phid = $xscript->getPHID();
|
||||||
$xscript_header = $xscript->getXHeraldRulesHeader();
|
$xscript_header = $xscript->getXHeraldRulesHeader();
|
||||||
|
|
||||||
|
|
||||||
$sub = array(
|
$sub = array(
|
||||||
'rev' => array(),
|
'rev' => array(),
|
||||||
'ccs' => $iface->getCCsAddedByHerald(),
|
'ccs' => $adapter->getCCsAddedByHerald(),
|
||||||
);
|
);
|
||||||
$rem_ccs = $iface->getCCsRemovedByHerald();
|
$rem_ccs = $adapter->getCCsRemovedByHerald();
|
||||||
*/
|
|
||||||
// TODO!
|
|
||||||
$sub = array(
|
|
||||||
'rev' => array(),
|
|
||||||
'ccs' => array(),
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$sub = array(
|
$sub = array(
|
||||||
'rev' => array(),
|
'rev' => array(),
|
||||||
|
@ -260,6 +248,8 @@ class DifferentialRevisionEditor {
|
||||||
// TODO: When Herald is brought over, run through this stuff to figure
|
// TODO: When Herald is brought over, run through this stuff to figure
|
||||||
// out which adds are Herald's fault.
|
// out which adds are Herald's fault.
|
||||||
|
|
||||||
|
// TODO: Still need to do this.
|
||||||
|
|
||||||
if ($add['ccs'] || $rem['ccs']) {
|
if ($add['ccs'] || $rem['ccs']) {
|
||||||
foreach (array_keys($add['ccs']) as $id) {
|
foreach (array_keys($add['ccs']) as $id) {
|
||||||
if (empty($new['ccs'][$id])) {
|
if (empty($new['ccs'][$id])) {
|
||||||
|
@ -358,10 +348,8 @@ class DifferentialRevisionEditor {
|
||||||
'actor' => $this->getActorPHID(),
|
'actor' => $this->getActorPHID(),
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: When timelines get implemented, move indexing to them.
|
// TODO: Move this into a worker task thing.
|
||||||
PhabricatorSearchDifferentialIndexer::indexRevision($revision);
|
PhabricatorSearchDifferentialIndexer::indexRevision($revision);
|
||||||
// TODO
|
|
||||||
// id(new ToolsTimelineEvent('difx', fb_json_encode($event)))->record();
|
|
||||||
|
|
||||||
if ($this->silentUpdate) {
|
if ($this->silentUpdate) {
|
||||||
return;
|
return;
|
||||||
|
@ -407,9 +395,8 @@ class DifferentialRevisionEditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($mail as $message) {
|
foreach ($mail as $message) {
|
||||||
// TODO
|
$message->setHeraldTranscriptURI($xscript_uri);
|
||||||
// $message->setHeraldTranscriptURI($xscript_uri);
|
$message->setXHeraldRulesHeader($xscript_header);
|
||||||
// $message->setXHeraldRulesHeader($xscript_header);
|
|
||||||
$message->send();
|
$message->send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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/mail/newdiff');
|
||||||
phutil_require_module('phabricator', 'applications/differential/storage/comment');
|
phutil_require_module('phabricator', 'applications/differential/storage/comment');
|
||||||
phutil_require_module('phabricator', 'applications/differential/storage/revision');
|
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/phid/handle/data');
|
||||||
phutil_require_module('phabricator', 'applications/search/index/indexer/differential');
|
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/qsprintf');
|
||||||
phutil_require_module('phabricator', 'storage/queryfx');
|
phutil_require_module('phabricator', 'storage/queryfx');
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ class HeraldDifferentialRevisionAdapter extends HeraldObjectAdapter {
|
||||||
protected $explicitCCs;
|
protected $explicitCCs;
|
||||||
protected $explicitReviewers;
|
protected $explicitReviewers;
|
||||||
protected $forbiddenCCs;
|
protected $forbiddenCCs;
|
||||||
protected $forbiddenReviewers;
|
|
||||||
|
|
||||||
protected $newCCs = array();
|
protected $newCCs = array();
|
||||||
protected $remCCs = array();
|
protected $remCCs = array();
|
||||||
|
@ -57,11 +56,6 @@ class HeraldDifferentialRevisionAdapter extends HeraldObjectAdapter {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setForbiddenReviewers($forbidden_reviewers) {
|
|
||||||
$this->forbiddenReviewers = $forbidden_reviewers;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCCsAddedByHerald() {
|
public function getCCsAddedByHerald() {
|
||||||
return array_diff_key($this->newCCs, $this->remCCs);
|
return array_diff_key($this->newCCs, $this->remCCs);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue