Skip to content

Commit

Permalink
fix(hitlnext): issues if agent user is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvitora committed Feb 23, 2024
1 parent aec507c commit 167f3f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions modules/hitlnext/src/helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { IAgent } from './types'

export function agentName(agent: IAgent) {
if (!agent) {
return '-'
}

const { firstname, lastname } = agent.attributes || {}

if (firstname || lastname) {
Expand Down
2 changes: 1 addition & 1 deletion modules/hitlnext/src/views/full/app/components/Comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Comment: FC<IComment> = props => {
if (state.currentAgent?.agentId === props.agentId) {
return lang.tr('module.hitlnext.handoff.you')
} else {
return agentName(agent)
return (agent && agentName(agent)) || props.agentId
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const HandoffItem: FC<IHandoff> = ({ createdAt, id, status, agentId, userConvers
return lang.tr('module.hitlnext.handoff.you')
} else if (agentId) {
const agent = state.agents[agentId]
return agentName(agent)
return (agent && agentName(agent)) || agentId
}
}
const getHandoffStyle = (createdAt, status) => {
Expand Down

0 comments on commit 167f3f1

Please sign in to comment.