Suppress title-only update comments to stop hourly comment spam
Comments on worsening condition now only fire on priority escalation. Title and description updates are silent — title changes (e.g. rising Power_On_Hours counters) were generating a comment on every hourly run. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+3
-13
@@ -271,20 +271,10 @@ if ($existing) {
|
||||
$updStmt->execute();
|
||||
$updStmt->close();
|
||||
|
||||
// Only add a comment when something meaningful changed (not just a description refresh)
|
||||
$meaningfulChanges = array_diff_key($changes, ['description_refreshed' => true]);
|
||||
if (!empty($meaningfulChanges)) {
|
||||
$changeLines = [];
|
||||
if (isset($changes['title'])) {
|
||||
$changeLines[] = "- **Title updated** to reflect current issue";
|
||||
}
|
||||
// Only post a comment on priority escalation — title and description updates
|
||||
// are silent (title changes like rising counters would spam a comment every run)
|
||||
if (isset($changes['priority'])) {
|
||||
$changeLines[] = "- **Priority escalated** from P{$changes['priority']['from']} to P{$changes['priority']['to']}";
|
||||
}
|
||||
// Wrap description in a fenced code block so ASCII art / box-drawing
|
||||
// characters render correctly instead of collapsing into a paragraph blob
|
||||
$commentText = "**hwmonDaemon reported a worsened condition — ticket updated automatically.**\n\n" .
|
||||
implode("\n", $changeLines) . "\n\nLatest report:\n\n```\n" . $description . "\n```";
|
||||
$commentText = "**hwmonDaemon escalated this ticket from P{$changes['priority']['from']} to P{$changes['priority']['to']}.**\n\n```\n" . $description . "\n```";
|
||||
$commentStmt = $conn->prepare(
|
||||
"INSERT INTO ticket_comments (ticket_id, user_id, user_name, comment_text, markdown_enabled) VALUES (?, ?, 'hwmonDaemon', ?, 1)"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user