From 09cea2b3887c51cb27eab4e2b6a51560fc287eb1 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Fri, 11 Sep 2026 14:05:01 -0400 Subject: [PATCH] Include ticket_id in comment-edit audit log so it appears on the timeline (#87) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AuditLogModel::getTicketTimeline() requires, for entity_type='comment' rows, that details.ticket_id match the ticket being viewed. logCommentCreate() and delete-comment's audit call both correctly include it; update_comment.php's audit call only set comment_text_preview, so an edited comment's audit row was written (visible in the admin's global Audit Log) but never matched the timeline's join condition — a comment edit left no trace on the ticket's own history, while deleting the same comment would be visible. Added ticket_id to the details array, using $comment['ticket_id'] already loaded earlier in the file for the access check. Verified against real MariaDB: the fixed shape now correctly appears in getTicketTimeline()'s results. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Lhz7pGMaoTfL5sdYS5XiKv --- api/update_comment.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/update_comment.php b/api/update_comment.php index f650031..e29c040 100644 --- a/api/update_comment.php +++ b/api/update_comment.php @@ -104,7 +104,10 @@ try { 'update', 'comment', (string)$commentId, - ['comment_text_preview' => substr($commentText, 0, 100)] + [ + 'ticket_id' => $comment['ticket_id'] ?? null, + 'comment_text_preview' => substr($commentText, 0, 100), + ] ); }