Only send Matrix notification on priority escalation, not title updates
Title changes (e.g. rising Power_On_Hours counter) were firing a Matrix ping every hour. Notifications now only trigger when priority escalates to a higher severity level. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -265,15 +265,19 @@ if ($existing) {
|
|||||||
['reason' => 'auto-updated by hwmonDaemon (condition worsened)']
|
['reason' => 'auto-updated by hwmonDaemon (condition worsened)']
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Only notify on priority escalation — title-only updates (e.g. rising
|
||||||
|
// Power_On_Hours counter) should not generate a Matrix ping every hour.
|
||||||
|
if (isset($changes['priority'])) {
|
||||||
require_once __DIR__ . '/helpers/NotificationHelper.php';
|
require_once __DIR__ . '/helpers/NotificationHelper.php';
|
||||||
NotificationHelper::sendTicketNotification($existingId, [
|
NotificationHelper::sendTicketNotification($existingId, [
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'priority' => $newPriority < $existingPriority ? $newPriority : $existingPriority,
|
'priority' => $changes['priority']['to'],
|
||||||
'category' => $category,
|
'category' => $category,
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'status' => $existingStatus,
|
'status' => $existingStatus,
|
||||||
], 'automated');
|
], 'automated');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$conn->close();
|
$conn->close();
|
||||||
echo json_encode([
|
echo json_encode([
|
||||||
|
|||||||
Reference in New Issue
Block a user