mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Make ACTION_NOTHING a "standard" action in Herald
Summary: Ref T8455. Multiple adapters implement essentially identical effects for ACTION_NOTHING. Consolidate them. Test Plan: Created several `ACTION_NOTHING` rules and updated the corresponding objects. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8455 Differential Revision: https://secure.phabricator.com/D13178
This commit is contained in:
parent
623aaf488d
commit
ce434e821c
9 changed files with 13 additions and 49 deletions
|
@ -333,7 +333,7 @@ return array(
|
||||||
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
||||||
'rsrc/js/application/calendar/behavior-day-view.js' => '5c46cff2',
|
'rsrc/js/application/calendar/behavior-day-view.js' => '5c46cff2',
|
||||||
'rsrc/js/application/calendar/behavior-event-all-day.js' => '38dcf3c8',
|
'rsrc/js/application/calendar/behavior-event-all-day.js' => '38dcf3c8',
|
||||||
'rsrc/js/application/calendar/behavior-recurring-edit.js' => '9c751e15',
|
'rsrc/js/application/calendar/behavior-recurring-edit.js' => '5f1c4d5f',
|
||||||
'rsrc/js/application/config/behavior-reorder-fields.js' => 'b6993408',
|
'rsrc/js/application/config/behavior-reorder-fields.js' => 'b6993408',
|
||||||
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '01774ab2',
|
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '01774ab2',
|
||||||
'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a',
|
'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a',
|
||||||
|
@ -630,7 +630,7 @@ return array(
|
||||||
'javelin-behavior-project-boards' => 'ba4fa35c',
|
'javelin-behavior-project-boards' => 'ba4fa35c',
|
||||||
'javelin-behavior-project-create' => '065227cc',
|
'javelin-behavior-project-create' => '065227cc',
|
||||||
'javelin-behavior-quicksand-blacklist' => '7927a7d3',
|
'javelin-behavior-quicksand-blacklist' => '7927a7d3',
|
||||||
'javelin-behavior-recurring-edit' => '9c751e15',
|
'javelin-behavior-recurring-edit' => '5f1c4d5f',
|
||||||
'javelin-behavior-refresh-csrf' => '7814b593',
|
'javelin-behavior-refresh-csrf' => '7814b593',
|
||||||
'javelin-behavior-releeph-preview-branch' => 'b2b4fbaf',
|
'javelin-behavior-releeph-preview-branch' => 'b2b4fbaf',
|
||||||
'javelin-behavior-releeph-request-state-change' => 'a0b57eb8',
|
'javelin-behavior-releeph-request-state-change' => 'a0b57eb8',
|
||||||
|
|
|
@ -95,12 +95,6 @@ abstract class HeraldPreCommitAdapter extends HeraldAdapter {
|
||||||
foreach ($effects as $effect) {
|
foreach ($effects as $effect) {
|
||||||
$action = $effect->getAction();
|
$action = $effect->getAction();
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case self::ACTION_NOTHING:
|
|
||||||
$result[] = new HeraldApplyTranscript(
|
|
||||||
$effect,
|
|
||||||
true,
|
|
||||||
pht('Did nothing.'));
|
|
||||||
break;
|
|
||||||
case self::ACTION_BLOCK:
|
case self::ACTION_BLOCK:
|
||||||
$result[] = new HeraldApplyTranscript(
|
$result[] = new HeraldApplyTranscript(
|
||||||
$effect,
|
$effect,
|
||||||
|
|
|
@ -1559,6 +1559,8 @@ abstract class HeraldAdapter {
|
||||||
return $this->applyFlagEffect($effect);
|
return $this->applyFlagEffect($effect);
|
||||||
case self::ACTION_EMAIL:
|
case self::ACTION_EMAIL:
|
||||||
return $this->applyEmailEffect($effect);
|
return $this->applyEmailEffect($effect);
|
||||||
|
case self::ACTION_NOTHING:
|
||||||
|
return $this->applyNothingEffect($effect);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1577,6 +1579,12 @@ abstract class HeraldAdapter {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function applyNothingEffect(HeraldEffect $effect) {
|
||||||
|
return new HeraldApplyTranscript(
|
||||||
|
$effect,
|
||||||
|
true,
|
||||||
|
pht('Did nothing.'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @task apply
|
* @task apply
|
||||||
|
|
|
@ -491,12 +491,6 @@ final class HeraldCommitAdapter extends HeraldAdapter {
|
||||||
foreach ($effects as $effect) {
|
foreach ($effects as $effect) {
|
||||||
$action = $effect->getAction();
|
$action = $effect->getAction();
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case self::ACTION_NOTHING:
|
|
||||||
$result[] = new HeraldApplyTranscript(
|
|
||||||
$effect,
|
|
||||||
true,
|
|
||||||
pht('Great success at doing nothing.'));
|
|
||||||
break;
|
|
||||||
case self::ACTION_ADD_CC:
|
case self::ACTION_ADD_CC:
|
||||||
foreach ($effect->getTarget() as $phid) {
|
foreach ($effect->getTarget() as $phid) {
|
||||||
if (empty($this->addCCPHIDs[$phid])) {
|
if (empty($this->addCCPHIDs[$phid])) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ final class HeraldDifferentialDiffAdapter extends HeraldDifferentialAdapter {
|
||||||
public function getActionNameMap($rule_type) {
|
public function getActionNameMap($rule_type) {
|
||||||
return array(
|
return array(
|
||||||
self::ACTION_BLOCK => pht('Block diff with message'),
|
self::ACTION_BLOCK => pht('Block diff with message'),
|
||||||
);
|
) + parent::getActionNameMap($rule_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHeraldField($field) {
|
public function getHeraldField($field) {
|
||||||
|
@ -141,12 +141,6 @@ final class HeraldDifferentialDiffAdapter extends HeraldDifferentialAdapter {
|
||||||
foreach ($effects as $effect) {
|
foreach ($effects as $effect) {
|
||||||
$action = $effect->getAction();
|
$action = $effect->getAction();
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case self::ACTION_NOTHING:
|
|
||||||
$result[] = new HeraldApplyTranscript(
|
|
||||||
$effect,
|
|
||||||
true,
|
|
||||||
pht('Did nothing.'));
|
|
||||||
break;
|
|
||||||
case self::ACTION_BLOCK:
|
case self::ACTION_BLOCK:
|
||||||
$result[] = new HeraldApplyTranscript(
|
$result[] = new HeraldApplyTranscript(
|
||||||
$effect,
|
$effect,
|
||||||
|
@ -154,10 +148,8 @@ final class HeraldDifferentialDiffAdapter extends HeraldDifferentialAdapter {
|
||||||
pht('Blocked diff.'));
|
pht('Blocked diff.'));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$result[] = new HeraldApplyTranscript(
|
$result[] = $this->applyStandardEffect($effect);
|
||||||
$effect,
|
break;
|
||||||
false,
|
|
||||||
pht('No rules to handle action "%s"!', $action));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,12 +293,6 @@ final class HeraldDifferentialRevisionAdapter
|
||||||
foreach ($effects as $effect) {
|
foreach ($effects as $effect) {
|
||||||
$action = $effect->getAction();
|
$action = $effect->getAction();
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case self::ACTION_NOTHING:
|
|
||||||
$result[] = new HeraldApplyTranscript(
|
|
||||||
$effect,
|
|
||||||
true,
|
|
||||||
pht('OK, did nothing.'));
|
|
||||||
break;
|
|
||||||
case self::ACTION_ADD_CC:
|
case self::ACTION_ADD_CC:
|
||||||
$base_target = $effect->getTarget();
|
$base_target = $effect->getTarget();
|
||||||
$forbidden = array();
|
$forbidden = array();
|
||||||
|
|
|
@ -148,12 +148,6 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
||||||
foreach ($effects as $effect) {
|
foreach ($effects as $effect) {
|
||||||
$action = $effect->getAction();
|
$action = $effect->getAction();
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case self::ACTION_NOTHING:
|
|
||||||
$result[] = new HeraldApplyTranscript(
|
|
||||||
$effect,
|
|
||||||
true,
|
|
||||||
pht('Great success at doing nothing.'));
|
|
||||||
break;
|
|
||||||
case self::ACTION_ADD_CC:
|
case self::ACTION_ADD_CC:
|
||||||
foreach ($effect->getTarget() as $phid) {
|
foreach ($effect->getTarget() as $phid) {
|
||||||
$this->ccPHIDs[] = $phid;
|
$this->ccPHIDs[] = $phid;
|
||||||
|
|
|
@ -117,12 +117,6 @@ final class HeraldPholioMockAdapter extends HeraldAdapter {
|
||||||
foreach ($effects as $effect) {
|
foreach ($effects as $effect) {
|
||||||
$action = $effect->getAction();
|
$action = $effect->getAction();
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case self::ACTION_NOTHING:
|
|
||||||
$result[] = new HeraldApplyTranscript(
|
|
||||||
$effect,
|
|
||||||
true,
|
|
||||||
pht('Great success at doing nothing.'));
|
|
||||||
break;
|
|
||||||
case self::ACTION_ADD_CC:
|
case self::ACTION_ADD_CC:
|
||||||
foreach ($effect->getTarget() as $phid) {
|
foreach ($effect->getTarget() as $phid) {
|
||||||
$this->ccPHIDs[] = $phid;
|
$this->ccPHIDs[] = $phid;
|
||||||
|
|
|
@ -118,12 +118,6 @@ final class PhrictionDocumentHeraldAdapter extends HeraldAdapter {
|
||||||
foreach ($effects as $effect) {
|
foreach ($effects as $effect) {
|
||||||
$action = $effect->getAction();
|
$action = $effect->getAction();
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case self::ACTION_NOTHING:
|
|
||||||
$result[] = new HeraldApplyTranscript(
|
|
||||||
$effect,
|
|
||||||
true,
|
|
||||||
pht('Great success at doing nothing.'));
|
|
||||||
break;
|
|
||||||
case self::ACTION_ADD_CC:
|
case self::ACTION_ADD_CC:
|
||||||
foreach ($effect->getTarget() as $phid) {
|
foreach ($effect->getTarget() as $phid) {
|
||||||
$this->ccPHIDs[] = $phid;
|
$this->ccPHIDs[] = $phid;
|
||||||
|
|
Loading…
Reference in a new issue