From f5c9f91d0ced8ca28f30481f2e4aff68800a34ca Mon Sep 17 00:00:00 2001 From: matheusbsilva137 Date: Thu, 21 Nov 2024 16:06:36 -0300 Subject: [PATCH 1/2] Add lastChat property to contact channel on visitor migration --- .../app/livechat/server/lib/contacts/mapVisitorToContact.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.ts b/apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.ts index ad1ac994ce0f..b104d6bbe146 100644 --- a/apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.ts +++ b/apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.ts @@ -22,6 +22,7 @@ export async function mapVisitorToContact(visitor: ILivechatVisitor, source: IOm blocked: false, verified: false, details: source, + lastChat: visitor.lastChat, }, ], customFields: visitor.livechatData, From fac143714f858bedcdf6d813860f139aa3c7e13d Mon Sep 17 00:00:00 2001 From: matheusbsilva137 Date: Thu, 21 Nov 2024 16:07:39 -0300 Subject: [PATCH 2/2] Add unit tests --- .../livechat/server/lib/contacts/mapVisitorToContact.spec.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.spec.ts b/apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.spec.ts index 65f26edfb83c..4b7d370d8741 100644 --- a/apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.spec.ts +++ b/apps/meteor/app/livechat/server/lib/contacts/mapVisitorToContact.spec.ts @@ -120,6 +120,10 @@ const dataMap: [Partial, IOmnichannelSource, CreateContactPara details: { type: OmnichannelSourceType.WIDGET, }, + lastChat: { + _id: 'last-chat-id', + ts: testDate, + }, }, ], customFields: undefined,