fix: SetTeam shows team name, TransactionCard receives teams

- Pass teams list to TransactionCard
- Resolve team name from tx.new_value (team_id)
- Shows 'Team -> Support' instead of just 'Team changed'

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Gjermund Høsøien Wiggen
2026-06-09 22:58:29 +02:00
parent 6f1d7bfa9b
commit dfcdbc623a

View File

@@ -104,10 +104,12 @@ function userLabel(users: User[], userId: string | null) {
function TransactionCard({
tx,
users,
teams,
customFieldLabels,
}: {
tx: Transaction;
users: User[];
teams: Team[];
customFieldLabels: Record<string, string>;
}) {
const isSystem =
@@ -134,7 +136,8 @@ function TransactionCard({
} else if (tx.transaction_type === "SetOwner") {
message = tx.new_value ? `Assigned to ${userLabel(users, tx.new_value)}` : "Unassigned";
} else if (tx.transaction_type === "SetTeam") {
message = "Team changed";
const teamName = tx.new_value ? (teams.find((t) => t.id === tx.new_value)?.name ?? "?") : null;
message = teamName ? `Team → ${teamName}` : "Team cleared";
} else if (tx.transaction_type === "CustomFieldChange") {
const fieldName = tx.field ? customFieldLabels[tx.field] ?? "Custom field" : "Custom field";
message = tx.new_value ? `${fieldName} set to ${tx.new_value}` : `${fieldName} cleared`;
@@ -664,6 +667,7 @@ export default function TicketDetailPage({
key={tx.id}
tx={tx}
users={users}
teams={teams}
customFieldLabels={customFieldLabels}
/>
))}