diff --git a/create_ticket_api.php b/create_ticket_api.php index f49f939..99eab78 100644 --- a/create_ticket_api.php +++ b/create_ticket_api.php @@ -312,9 +312,18 @@ if ($existing) { $updStmt->close(); // Only post a comment on priority escalation — title and description updates - // are silent (title changes like rising counters would spam a comment every run) + // are silent (title changes like rising counters would spam a comment every run). + // Keep it short: the full sensor data is refreshed in the ticket description, + // so the comment just records the bump + a brief reason (no ASCII dump). if (isset($changes['priority'])) { - $commentText = "**hwmonDaemon escalated this ticket from P{$changes['priority']['from']} to P{$changes['priority']['to']}.**\n\n```\n" . $description . "\n```"; + $pLabels = [1 => 'P1 (Critical)', 2 => 'P2 (High)', 3 => 'P3 (Medium)', 4 => 'P4 (Low)', 5 => 'P5 (Minimal)']; + $fromP = (int)$changes['priority']['from']; + $toP = (int)$changes['priority']['to']; + $fromL = $pLabels[$fromP] ?? "P{$fromP}"; + $toL = $pLabels[$toP] ?? "P{$toP}"; + $commentText = "**hwmonDaemon raised priority {$fromL} → {$toL}.**\n\n" + . "The latest monitoring scan reported a more severe condition for this issue, " + . "so it now needs faster attention. Current sensor data is in the ticket description above."; $commentStmt = $conn->prepare( "INSERT INTO ticket_comments (ticket_id, user_id, user_name, comment_text, markdown_enabled) VALUES (?, ?, 'hwmonDaemon', ?, 1)" ); @@ -362,7 +371,7 @@ if ($existing) { $reopenStmt->close(); $commentText = "**Issue recurred — ticket reopened automatically.**\n\n" . - "New report received from hwmonDaemon:\n\n```\n" . $description . "\n```"; + "hwmonDaemon detected this condition again. Current sensor data is in the ticket description above."; $commentStmt = $conn->prepare( "INSERT INTO ticket_comments (ticket_id, user_id, user_name, comment_text, markdown_enabled) VALUES (?, ?, 'hwmonDaemon', ?, 1)" );