mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Allow pre-commit adapter to use custom actions
Summary: Looks like I missed this when implementing custom actions and hence you can't currently use custom actions on the pre-commit adapters. Test Plan: Added a custom action to a pre-commit Herald rule. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D10316
This commit is contained in:
parent
b163883d88
commit
2fd395e859
5 changed files with 34 additions and 14 deletions
|
@ -72,16 +72,20 @@ abstract class HeraldPreCommitAdapter extends HeraldAdapter {
|
|||
switch ($rule_type) {
|
||||
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
|
||||
case HeraldRuleTypeConfig::RULE_TYPE_OBJECT:
|
||||
return array(
|
||||
self::ACTION_BLOCK,
|
||||
self::ACTION_EMAIL,
|
||||
self::ACTION_NOTHING
|
||||
);
|
||||
return array_merge(
|
||||
array(
|
||||
self::ACTION_BLOCK,
|
||||
self::ACTION_EMAIL,
|
||||
self::ACTION_NOTHING,
|
||||
),
|
||||
parent::getActions($rule_type));
|
||||
case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL:
|
||||
return array(
|
||||
self::ACTION_EMAIL,
|
||||
self::ACTION_NOTHING,
|
||||
);
|
||||
return array_merge(
|
||||
array(
|
||||
self::ACTION_EMAIL,
|
||||
self::ACTION_NOTHING,
|
||||
),
|
||||
parent::getActions($rule_type));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,7 +122,15 @@ abstract class HeraldPreCommitAdapter extends HeraldAdapter {
|
|||
pht('Blocked push.'));
|
||||
break;
|
||||
default:
|
||||
throw new Exception(pht('No rules to handle action "%s"!', $action));
|
||||
$custom_result = parent::handleCustomHeraldEffect($effect);
|
||||
if ($custom_result === null) {
|
||||
throw new Exception(pht(
|
||||
"No rules to handle action '%s'.",
|
||||
$action));
|
||||
}
|
||||
|
||||
$result[] = $custom_result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -544,7 +544,9 @@ final class HeraldCommitAdapter extends HeraldAdapter {
|
|||
default:
|
||||
$custom_result = parent::handleCustomHeraldEffect($effect);
|
||||
if ($custom_result === null) {
|
||||
throw new Exception("No rules to handle action '{$action}'.");
|
||||
throw new Exception(pht(
|
||||
"No rules to handle action '%s'.",
|
||||
$action));
|
||||
}
|
||||
|
||||
$result[] = $custom_result;
|
||||
|
|
|
@ -422,7 +422,9 @@ final class HeraldDifferentialRevisionAdapter
|
|||
default:
|
||||
$custom_result = parent::handleCustomHeraldEffect($effect);
|
||||
if ($custom_result === null) {
|
||||
throw new Exception("No rules to handle action '{$action}'.");
|
||||
throw new Exception(pht(
|
||||
"No rules to handle action '%s'.",
|
||||
$action));
|
||||
}
|
||||
|
||||
$result[] = $custom_result;
|
||||
|
|
|
@ -207,7 +207,9 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
|||
default:
|
||||
$custom_result = parent::handleCustomHeraldEffect($effect);
|
||||
if ($custom_result === null) {
|
||||
throw new Exception("No rules to handle action '{$action}'.");
|
||||
throw new Exception(pht(
|
||||
"No rules to handle action '%s'.",
|
||||
$action));
|
||||
}
|
||||
|
||||
$result[] = $custom_result;
|
||||
|
|
|
@ -139,7 +139,9 @@ final class HeraldPholioMockAdapter extends HeraldAdapter {
|
|||
default:
|
||||
$custom_result = parent::handleCustomHeraldEffect($effect);
|
||||
if ($custom_result === null) {
|
||||
throw new Exception("No rules to handle action '{$action}'.");
|
||||
throw new Exception(pht(
|
||||
"No rules to handle action '%s'.",
|
||||
$action));
|
||||
}
|
||||
|
||||
$result[] = $custom_result;
|
||||
|
|
Loading…
Reference in a new issue