Skip to content

Commit 59d3a1e

Browse files
committed
refactor: admin alert email notification
1 parent 88cec30 commit 59d3a1e

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

includes/Core/Util/EmailNotification.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ final class EmailNotification
2121
*/
2222
public static function sendFailureNotification($flowId, $actionName, $triggerName, $recordType, $errorMessage)
2323
{
24-
$appConfig = get_option('btcbi_app_conf');
25-
if (!isset($appConfig->enable_failure_email) || $appConfig->enable_failure_email != 1) {
26-
return false;
27-
}
28-
2924
$adminEmail = get_option('admin_email');
3025
if (empty($adminEmail)) {
3126
return false;

includes/Log/LogHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ public static function save($flow_id, $api_type, $response_type, $response_obj)
9393
]
9494
);
9595

96-
// Send email notification if integration failed
97-
if ($response_type === 'error' || $response_type === 'validation') {
96+
$appConfig = get_option('btcbi_app_conf');
97+
if (\in_array($response_type, ['error', 'validation']) && !empty($appConfig->enable_failure_email)) {
9898
self::sendFailureEmail($flow_id, $api_type, $response_obj);
9999
}
100100
}

0 commit comments

Comments
 (0)