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.
This commit is contained in:
@@ -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 }
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user