diff --git a/app/definitions/ILivechatVisitor.ts b/app/definitions/ILivechatVisitor.ts index 8a942909a..85f90102e 100644 --- a/app/definitions/ILivechatVisitor.ts +++ b/app/definitions/ILivechatVisitor.ts @@ -22,7 +22,7 @@ export interface IVisitorEmail { export interface ILivechatVisitor extends IRocketChatRecord { username: string; - ts: Date; + ts: Date | string; token: string; department?: string; name?: string; diff --git a/app/views/RoomInfoView/CustomFields.tsx b/app/views/RoomInfoView/CustomFields.tsx index 0034261bd..ccdf863d3 100644 --- a/app/views/RoomInfoView/CustomFields.tsx +++ b/app/views/RoomInfoView/CustomFields.tsx @@ -2,7 +2,7 @@ import React from 'react'; import Item from './Item'; -const CustomFields = ({ customFields }: { customFields: { [key: string]: string } }) => { +const CustomFields = ({ customFields }: { customFields?: { [key: string]: string } }) => { if (customFields) { return ( <> diff --git a/app/views/RoomInfoView/Direct.tsx b/app/views/RoomInfoView/Direct.tsx index a3dffced3..c5fee5d02 100644 --- a/app/views/RoomInfoView/Direct.tsx +++ b/app/views/RoomInfoView/Direct.tsx @@ -7,8 +7,9 @@ import { useTheme } from '../../theme'; import Timezone from './Timezone'; import CustomFields from './CustomFields'; import styles from './styles'; +import { IUserParsed } from '.'; -const Roles = ({ roles }: { roles: string[] }) => { +const Roles = ({ roles }: { roles?: string[] }) => { const { theme } = useTheme(); if (roles && roles.length) { @@ -29,7 +30,7 @@ const Roles = ({ roles }: { roles: string[] }) => { return null; }; -const Direct = ({ roomUser }: { roomUser: any }) => ( +const Direct = ({ roomUser }: { roomUser: IUserParsed }) => ( <> diff --git a/app/views/RoomInfoView/index.tsx b/app/views/RoomInfoView/index.tsx index a19217ef4..65798811c 100644 --- a/app/views/RoomInfoView/index.tsx +++ b/app/views/RoomInfoView/index.tsx @@ -93,7 +93,7 @@ interface IRoomInfoViewProps { roles: { [key: string]: string }; } -interface IUserParsed extends IUser { +export interface IUserParsed extends IUser { parsedRoles?: string[]; } @@ -104,8 +104,7 @@ export interface ILivechatVisitorModified extends ILivechatVisitor { interface IRoomInfoViewState { room: ISubscription; - // TODO: Could be IUserParsed or ILivechatVisitorModified - roomUser: any; + roomUser: IUserParsed | ILivechatVisitorModified; showEdit: boolean; } @@ -214,7 +213,7 @@ class RoomInfoView extends React.Component this.setHeader()); + this.setState({ roomUser: { ...visitor, ...params } as ILivechatVisitorModified }, () => this.setHeader()); } } } catch (error) { @@ -245,14 +244,14 @@ class RoomInfoView extends React.Component; + return ; } if (this.t === SubscriptionType.OMNICHANNEL) { - return ; + return ; } return ; }; @@ -424,20 +423,21 @@ class RoomInfoView extends React.Component - {this.renderAvatar(room, roomUser)} + {this.renderAvatar(room, roomUserParsed)} {renderRoomTitle({ room, type: this.t, - name: roomUser?.name, - username: roomUser?.username, - statusText: roomUser?.statusText, + name: roomUserParsed?.name, + username: roomUserParsed?.username, + statusText: roomUserParsed?.statusText, theme })}