Skip to content

Commit 167f3f1

Browse files
committed
fix(hitlnext): issues if agent user is deleted
1 parent aec507c commit 167f3f1

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

modules/hitlnext/src/helper.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { IAgent } from './types'
22

33
export function agentName(agent: IAgent) {
4+
if (!agent) {
5+
return '-'
6+
}
7+
48
const { firstname, lastname } = agent.attributes || {}
59

610
if (firstname || lastname) {

modules/hitlnext/src/views/full/app/components/Comment.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const Comment: FC<IComment> = props => {
2020
if (state.currentAgent?.agentId === props.agentId) {
2121
return lang.tr('module.hitlnext.handoff.you')
2222
} else {
23-
return agentName(agent)
23+
return (agent && agentName(agent)) || props.agentId
2424
}
2525
}
2626

modules/hitlnext/src/views/full/app/components/HandoffItem.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const HandoffItem: FC<IHandoff> = ({ createdAt, id, status, agentId, userConvers
5252
return lang.tr('module.hitlnext.handoff.you')
5353
} else if (agentId) {
5454
const agent = state.agents[agentId]
55-
return agentName(agent)
55+
return (agent && agentName(agent)) || agentId
5656
}
5757
}
5858
const getHandoffStyle = (createdAt, status) => {

0 commit comments

Comments
 (0)