From 88ab30a7fd5d50f7867aad1c2156ae1d4efd8c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gjermund=20H=C3=B8s=C3=B8ien=20Wiggen?= Date: Sun, 7 Jun 2026 23:06:25 +0200 Subject: [PATCH] Fix transaction_type case mismatch in both ticket pages Backend returns PascalCase (Create, StatusChange, SetOwner, Comment, Correspond). Frontend was checking lowercase, causing transaction rendering to fall through to raw type strings. --- web/src/app/page.tsx | 20 ++++++++++---------- web/src/app/tickets/[id]/page.tsx | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/web/src/app/page.tsx b/web/src/app/page.tsx index 9c44477..c6ce2cd 100644 --- a/web/src/app/page.tsx +++ b/web/src/app/page.tsx @@ -210,12 +210,12 @@ function TicketDetailPanel({ )} {transactions.map((tx) => { const isSystem = - tx.transaction_type === "status_change" || - tx.transaction_type === "assignment" || - tx.transaction_type === "create"; + tx.transaction_type === "StatusChange" || + tx.transaction_type === "SetOwner" || + tx.transaction_type === "Create"; const isAgent = - tx.transaction_type === "agent_reply" || - tx.transaction_type === "internal_note"; + tx.transaction_type === "Correspond" || + tx.transaction_type === "Comment"; if (isSystem) { const txTimeAgo = formatDistanceToNow( @@ -223,9 +223,9 @@ function TicketDetailPanel({ { addSuffix: true } ); let message = ""; - if (tx.transaction_type === "create") { - message = "Ticket created"; - } else if (tx.transaction_type === "status_change") { + if (tx.transaction_type === "Create") { + message = "Ticket created"; + } else if (tx.transaction_type === "StatusChange") { const oldLabel = tx.old_value ? STATUS_LABELS[tx.old_value] || tx.old_value : "?"; @@ -233,7 +233,7 @@ function TicketDetailPanel({ ? STATUS_LABELS[tx.new_value] || tx.new_value : "?"; message = `${getInitial(tx.creator_id)} changed status from ${oldLabel} to ${newLabel}`; - } else if (tx.transaction_type === "assignment") { + } else if (tx.transaction_type === "SetOwner") { message = tx.new_value ? `${getInitial(tx.creator_id)} assigned to ${tx.new_value}` : `${getInitial(tx.creator_id)} unassigned`; @@ -253,7 +253,7 @@ function TicketDetailPanel({ } const isInternal = - tx.transaction_type === "internal_note"; + tx.transaction_type === "Comment"; const txTimeAgo = formatDistanceToNow( new Date(tx.created_at), { addSuffix: true } diff --git a/web/src/app/tickets/[id]/page.tsx b/web/src/app/tickets/[id]/page.tsx index e212937..5062d7f 100644 --- a/web/src/app/tickets/[id]/page.tsx +++ b/web/src/app/tickets/[id]/page.tsx @@ -60,23 +60,23 @@ function TransactionBubble({ tx: Transaction; }) { const isSystem = - tx.transaction_type === "status_change" || - tx.transaction_type === "assignment" || - tx.transaction_type === "create"; - const isAgent = tx.transaction_type === "agent_reply" || tx.transaction_type === "internal_note"; + tx.transaction_type === "StatusChange" || + tx.transaction_type === "SetOwner" || + tx.transaction_type === "Create"; + const isAgent = tx.transaction_type === "Correspond" || tx.transaction_type === "Comment"; if (isSystem) { const timeAgo = formatDistanceToNow(new Date(tx.created_at), { addSuffix: true, }); let message = ""; - if (tx.transaction_type === "create") { + if (tx.transaction_type === "Create") { message = `Ticket created`; - } else if (tx.transaction_type === "status_change") { + } else if (tx.transaction_type === "StatusChange") { const oldLabel = tx.old_value ? STATUS_LABELS[tx.old_value] || tx.old_value : "?"; const newLabel = tx.new_value ? STATUS_LABELS[tx.new_value] || tx.new_value : "?"; message = `${getInitial(tx.creator_id)} changed status from ${oldLabel} to ${newLabel}`; - } else if (tx.transaction_type === "assignment") { + } else if (tx.transaction_type === "SetOwner") { message = tx.new_value ? `${getInitial(tx.creator_id)} assigned to ${tx.new_value}` : `${getInitial(tx.creator_id)} unassigned`; @@ -93,7 +93,7 @@ function TransactionBubble({ ); } - const isInternal = tx.transaction_type === "internal_note"; + const isInternal = tx.transaction_type === "Comment"; const timeAgo = formatDistanceToNow(new Date(tx.created_at), { addSuffix: true, });