1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

Use standard subscribers effects in Herald Adapter for commits

Summary: Ref T8455. Use the standard actions in commit rules, instead of a custom action.

Test Plan: Wrote an "add cc" Herald rule for commits, pushed a commit, saw the rule fire correctly.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8455

Differential Revision: https://secure.phabricator.com/D13181
This commit is contained in:
epriestley 2015-06-08 10:31:38 -07:00
parent e2b0f814d4
commit ab5f7a868e
2 changed files with 3 additions and 26 deletions

View file

@ -889,6 +889,7 @@ final class PhabricatorAuditEditor
"H{$rule_id}"));
}
}
if ($audit_phids) {
$xactions[] = id(new PhabricatorAuditTransaction())
->setTransactionType(PhabricatorAuditActionConstants::ADD_AUDITORS)
@ -900,15 +901,6 @@ final class PhabricatorAuditEditor
'auditReasonMap', $this->auditReasonMap);
}
$cc_phids = $adapter->getAddCCMap();
$add_ccs = array('+' => array());
foreach ($cc_phids as $phid => $rule_ids) {
$add_ccs['+'][$phid] = $phid;
}
$xactions[] = id(new PhabricatorAuditTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
->setNewValue($add_ccs);
HarbormasterBuildable::applyBuildPlans(
$object->getPHID(),
$object->getRepository()->getPHID(),

View file

@ -13,7 +13,6 @@ final class HeraldCommitAdapter extends HeraldAdapter {
protected $commitData;
private $commitDiff;
protected $addCCPHIDs = array();
protected $auditMap = array();
protected $buildPlans = array();
@ -141,6 +140,7 @@ final class HeraldCommitAdapter extends HeraldAdapter {
return array_merge(
array(
self::ACTION_ADD_CC,
self::ACTION_REMOVE_CC,
self::ACTION_EMAIL,
self::ACTION_AUDIT,
self::ACTION_APPLY_BUILD_PLANS,
@ -151,6 +151,7 @@ final class HeraldCommitAdapter extends HeraldAdapter {
return array_merge(
array(
self::ACTION_ADD_CC,
self::ACTION_REMOVE_CC,
self::ACTION_EMAIL,
self::ACTION_FLAG,
self::ACTION_AUDIT,
@ -220,10 +221,6 @@ final class HeraldCommitAdapter extends HeraldAdapter {
return $this->commit->getPHID();
}
public function getAddCCMap() {
return $this->addCCPHIDs;
}
public function getAuditMap() {
return $this->auditMap;
}
@ -491,18 +488,6 @@ final class HeraldCommitAdapter extends HeraldAdapter {
foreach ($effects as $effect) {
$action = $effect->getAction();
switch ($action) {
case self::ACTION_ADD_CC:
foreach ($effect->getTarget() as $phid) {
if (empty($this->addCCPHIDs[$phid])) {
$this->addCCPHIDs[$phid] = array();
}
$this->addCCPHIDs[$phid][] = $effect->getRule()->getID();
}
$result[] = new HeraldApplyTranscript(
$effect,
true,
pht('Added address to CC.'));
break;
case self::ACTION_AUDIT:
foreach ($effect->getTarget() as $phid) {
if (empty($this->auditMap[$phid])) {