Fix Dummy alert transport (#10379)

This commit is contained in:
Tony Murray
2019-06-26 09:47:03 -05:00
committed by GitHub
parent ad6ac30528
commit dd2fc0baf8
2 changed files with 13 additions and 16 deletions

View File

@@ -40,6 +40,9 @@ class Dummy extends Transport
public static function configTemplate()
{
return [];
return [
'validation' => [],
'config' => [],
];
}
}

View File

@@ -91,18 +91,16 @@ if (empty($name)) {
}
$status = 'error';
} else {
$transport_config = json_decode(dbFetchCell('SELECT transport_config FROM alert_transports WHERE transport_id=?', [$transport_id]), true);
$transport_config = (array)json_decode(dbFetchCell('SELECT transport_config FROM alert_transports WHERE transport_id=?', [$transport_id]), true);
foreach ($result['config'] as $tmp_config) {
if (isset($tmp_config['name']) && $tmp_config['type'] !== 'hidden') {
$transport_config[$tmp_config['name']] = $vars[$tmp_config['name']];
}
}
//Update the json config field
if ($transport_config) {
$transport_config = json_encode($transport_config);
$detail = [
'transport_type' => $transport_type,
'transport_config' => $transport_config
'transport_config' => json_encode($transport_config)
];
$where = 'transport_id=?';
@@ -110,10 +108,6 @@ if (empty($name)) {
$status = 'ok';
$message = 'Updated alert transports';
} else {
$status = 'error';
$message = 'There was an issue with the transport config';
}
}
if ($status == 'error' && $newEntry) {
//If error, we will have to delete the new entry in alert_transports tbl