Page MenuHomePhabricator

D12957.id31223.diff
No OneTemporary

D12957.id31223.diff

diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php
--- a/src/applications/herald/adapter/HeraldAdapter.php
+++ b/src/applications/herald/adapter/HeraldAdapter.php
@@ -536,7 +536,9 @@
return $this->getCustomFieldConditions($field);
}
throw new Exception(
- "This adapter does not define conditions for field '{$field}'!");
+ pht(
+ "This adapter does not define conditions for field '%s'!",
+ $field));
}
}
@@ -1197,7 +1199,15 @@
$rule_global = HeraldRuleTypeConfig::RULE_TYPE_GLOBAL;
$action_type = $action->getAction();
- $action_name = idx($this->getActionNameMap($rule_global), $action_type);
+
+ $default = $this->isHeraldCustomKey($action_type)
+ ? pht('(Unknown Custom Action "%s") equals', $action_type)
+ : pht('(Unknown Action "%s") equals', $action_type);
+
+ $action_name = idx(
+ $this->getActionNameMap($rule_global),
+ $action_type,
+ $default);
$target = $this->renderActionTargetAsText($action, $handles);
diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php
--- a/src/applications/herald/controller/HeraldRuleController.php
+++ b/src/applications/herald/controller/HeraldRuleController.php
@@ -354,7 +354,6 @@
if ($rule->getConditions()) {
$serial_conditions = array();
foreach ($rule->getConditions() as $condition) {
-
$value = $condition->getValue();
switch ($condition->getFieldName()) {
case HeraldAdapter::FIELD_TASK_PRIORITY:
@@ -394,10 +393,10 @@
$serial_actions = array(
array('default', ''),
);
+
if ($rule->getActions()) {
$serial_actions = array();
foreach ($rule->getActions() as $action) {
-
switch ($action->getAction()) {
case HeraldAdapter::ACTION_FLAG:
case HeraldAdapter::ACTION_BLOCK:
@@ -452,7 +451,11 @@
$config_info['actions'] = $action_map;
foreach ($config_info['fields'] as $field => $name) {
- $field_conditions = $adapter->getConditionsForField($field);
+ try {
+ $field_conditions = $adapter->getConditionsForField($field);
+ } catch (Exception $ex) {
+ $field_conditions = array();
+ }
$config_info['conditionMap'][$field] = $field_conditions;
}
diff --git a/src/applications/herald/engine/HeraldEngine.php b/src/applications/herald/engine/HeraldEngine.php
--- a/src/applications/herald/engine/HeraldEngine.php
+++ b/src/applications/herald/engine/HeraldEngine.php
@@ -269,6 +269,17 @@
$result = false;
} else {
foreach ($conditions as $condition) {
+
+ try {
+ $object->getHeraldField($condition->getFieldName());
+ } catch (Exception $ex) {
+ $reason = pht(
+ 'Field "%s" does not exist!',
+ $condition->getFieldName());
+ $result = false;
+ break;
+ }
+
$match = $this->doesConditionMatch($rule, $condition, $object);
if (!$all && $match) {
diff --git a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
--- a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
+++ b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
@@ -254,6 +254,11 @@
_renderValueInputForRow : function(row_id) {
var cond = this._config.conditions[row_id];
+
+ if (!cond[1]) {
+ return;
+ }
+
var type = this._config.info.values[cond[0]][cond[1]];
var input = this._buildInput(type);

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 19, 10:59 AM (3 d, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7661556
Default Alt Text
D12957.id31223.diff (3 KB)

Event Timeline