diff --git a/client/components/RoomIcon/OmnichannelRoomIcon/OmnichannelCoreSourceRoomIcon.tsx b/client/components/RoomIcon/OmnichannelRoomIcon/OmnichannelCoreSourceRoomIcon.tsx index 5a53d7d89f6..c8a1c68dcfe 100644 --- a/client/components/RoomIcon/OmnichannelRoomIcon/OmnichannelCoreSourceRoomIcon.tsx +++ b/client/components/RoomIcon/OmnichannelRoomIcon/OmnichannelCoreSourceRoomIcon.tsx @@ -26,6 +26,6 @@ export const OmnichannelCoreSourceRoomIcon = ({ room: IOmnichannelRoom; size: ComponentProps['size']; }): ReactElement => { - const icon = iconMap[room.source.type] || 'headset'; + const icon = iconMap[room.source?.type || 'other'] || 'headset'; return ; }; diff --git a/client/hooks/useRoomIcon.tsx b/client/hooks/useRoomIcon.tsx index 3fb8ffbddc3..3c88b69d837 100644 --- a/client/hooks/useRoomIcon.tsx +++ b/client/hooks/useRoomIcon.tsx @@ -28,7 +28,7 @@ export const useRoomIcon = (room: IRoom): ReactNode | { name: string; color?: st app: 'headset', // TODO: use app icon api: 'headset', // TODO: use api icon other: 'headset', - }[room.source.type] || 'headset'; + }[room.source?.type || 'other'] || 'headset'; return { name: icon, diff --git a/client/views/omnichannel/directory/chats/contextualBar/ChatInfo.js b/client/views/omnichannel/directory/chats/contextualBar/ChatInfo.js index 5f1cb3015d9..f399dfe91f4 100644 --- a/client/views/omnichannel/directory/chats/contextualBar/ChatInfo.js +++ b/client/views/omnichannel/directory/chats/contextualBar/ChatInfo.js @@ -25,6 +25,7 @@ import PriorityField from './PriorityField'; import SourceField from './SourceField'; import VisitorClientInfo from './VisitorClientInfo'; +// TODO: Remove moment we are mixing moment and our own formatters :sadface: function ChatInfo({ id, route }) { const t = useTranslation(); @@ -54,8 +55,10 @@ function ChatInfo({ id, route }) { } = room || { room: { v: {} } }; const routePath = useRoute(route || 'omnichannel-directory'); + // TODO: use hook instead const canViewCustomFields = () => hasPermission('view-livechat-room-customfields'); const subscription = useUserSubscription(id); + // TODO: use hook instead const hasGlobalEditRoomPermission = hasPermission('save-others-livechat-room-info'); const hasLocalEditRoomPermission = servedBy?._id === Meteor.userId(); const visitorId = v?._id; diff --git a/definition/IRoom.ts b/definition/IRoom.ts index e190d0fa8f7..6c2d415afe4 100644 --- a/definition/IRoom.ts +++ b/definition/IRoom.ts @@ -121,7 +121,7 @@ export interface IOmnichannelRoom extends Omit