refactor: remove Subject field from Conversation model and related logic, replace with CustomerName

This commit is contained in:
mlogclub
2026-04-27 19:22:40 +08:00
parent 2d2d2d2051
commit 3a9bc4914a
24 changed files with 49 additions and 64 deletions
@@ -249,7 +249,7 @@ export function ConversationDetailDialog({
onOpenChange={onOpenChange}
title={
<div className="flex items-center gap-3">
<span>{currentConversation?.subject || "会话详情"}</span>
<span>{currentConversation?.customerName || "会话详情"}</span>
<div>
{statusMeta ? (
@@ -597,7 +597,7 @@ export default function DashboardConversationsPage() {
setActionLoadingId(item.id)
try {
await markConversationRead(item.id)
toast.success(`已标记已读:${item.subject || `#${item.id}`}`)
toast.success(`已标记已读:${item.customerName || `#${item.id}`}`)
await loadConversations()
if (detailItem?.id === item.id) {
await refreshDetail()
@@ -613,7 +613,7 @@ export default function DashboardConversationsPage() {
setActionLoadingId(item.id)
try {
await dispatchConversation(item.id)
toast.success(`已触发自动分配:${item.subject || `#${item.id}`}`)
toast.success(`已触发自动分配:${item.customerName || `#${item.id}`}`)
await loadConversations()
if (detailItem?.id === item.id) {
await refreshDetail()
@@ -724,7 +724,7 @@ export default function DashboardConversationsPage() {
<TableRow key={item.id}>
<TableCell className="max-w-60">
<div className="min-w-0">
<div className="font-medium">{item.subject || `会话 #${item.id}`}</div>
<div className="font-medium">{item.customerName || `客户 #${item.customerId || item.id}`}</div>
<div className="mt-1 text-sm text-muted-foreground">
ID{item.channelId || "-"}
</div>
@@ -755,7 +755,7 @@ export default function DashboardConversationsPage() {
<DropdownMenu>
<DropdownMenuTrigger
render={<Button variant="outline" size="icon-sm" />}
aria-label={`更多操作 ${item.subject || item.id}`}
aria-label={`更多操作 ${item.customerName || item.id}`}
>
<MoreHorizontalIcon />
</DropdownMenuTrigger>
@@ -480,7 +480,7 @@ export function ChatPanel() {
<DialogTitle></DialogTitle>
<DialogDescription>
{conversation
? `确认认领“${conversation.subject}”吗?认领后会话会进入我的列表。`
? `确认认领“${conversation.customerName || `客户 #${conversation.customerId || conversation.id}`}”吗?认领后会话会进入我的列表。`
: "确认认领当前会话吗?"}
</DialogDescription>
</DialogHeader>
@@ -73,7 +73,7 @@ export function ConversationList({ onAfterSelect }: ConversationListProps) {
<div className="min-w-0 flex-1">
<div className="flex items-center gap-1.5">
<span className="min-w-0 flex-1 truncate font-medium text-sm leading-4">
{conversation.subject}
{conversation.customerName || `客户 #${conversation.customerId || conversation.id}`}
</span>
{conversation.agentUnreadCount > 0 ? (
<div className="flex size-4.5 shrink-0 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground">
+2 -2
View File
@@ -272,7 +272,7 @@ export default function ConversationsPage() {
<div className="min-w-0">
<div className="flex items-center gap-2">
<p className="min-w-0 truncate font-medium leading-tight">
{conversation.subject}
{conversation.customerName || `客户 #${conversation.customerId || conversation.id}`}
</p>
<span
className={`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 text-[11px] ${
@@ -474,7 +474,7 @@ export default function ConversationsPage() {
conversation
? {
id: conversation.id,
subject: conversation.subject,
customerName: conversation.customerName,
customerId: conversation.customerId ?? 0,
lastMessageSummary: conversation.lastMessageSummary,
currentAssigneeId: conversation.currentAssigneeId,
@@ -7,7 +7,7 @@ import { EditDialog } from "./edit"
type ConversationSeed = {
id: number
subject: string
customerName: string
customerId?: number
lastMessageSummary?: string
currentAssigneeId?: number
@@ -28,7 +28,7 @@ export function CreateTicketFromConversationDialog({
}: CreateTicketFromConversationDialogProps) {
const initialValues = conversation
? {
title: conversation.subject || "",
title: conversation.customerName || "",
description: conversation.lastMessageSummary || "",
priority: 2,
severity: 1,
+1 -1
View File
@@ -880,7 +880,7 @@ export default function TicketDetailPage() {
{sourceConversation ? (
<SurfacePanel className="p-2.5">
<div className="text-sm font-medium">
{sourceConversation.subject || "未命名会话"}
{sourceConversation.customerName || "未命名客户"}
</div>
<div className="mt-2 flex flex-wrap gap-2 text-xs text-muted-foreground">
<span>
+2 -1
View File
@@ -109,7 +109,8 @@ export type ConversationParticipant = {
export type AdminConversation = {
id: number
channelId: number
subject: string
customerId: number
customerName: string
status: number
serviceMode: number
priority: number
+1 -1
View File
@@ -37,7 +37,7 @@ export type AgentConversation = {
aiAgentId?: number
channelId?: number
customerId?: number
subject: string
customerName: string
status: number
serviceMode: number
priority: number
+1 -1
View File
@@ -34,7 +34,7 @@ export type ImConversationParticipant = {
export type ImConversation = {
id: number
channelId: number
subject: string
customerName: string
status: number
serviceMode: number
priority: number