From de1ff87c7821a9a36b28bf19d9571c2b7d0a05d6 Mon Sep 17 00:00:00 2001 From: matheusbsilva137 Date: Thu, 8 Aug 2024 19:50:12 -0300 Subject: [PATCH] do not consider visitor messages as responses in livechat metrics --- apps/meteor/app/livechat/server/hooks/saveAnalyticsData.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/meteor/app/livechat/server/hooks/saveAnalyticsData.ts b/apps/meteor/app/livechat/server/hooks/saveAnalyticsData.ts index 11c6219b4415..9c397164af9e 100644 --- a/apps/meteor/app/livechat/server/hooks/saveAnalyticsData.ts +++ b/apps/meteor/app/livechat/server/hooks/saveAnalyticsData.ts @@ -1,4 +1,4 @@ -import { isEditedMessage, isSystemMessage } from '@rocket.chat/core-typings'; +import { isEditedMessage, isSystemMessage, isMessageFromVisitor } from '@rocket.chat/core-typings'; import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; import { LivechatRooms } from '@rocket.chat/models'; @@ -70,7 +70,7 @@ callbacks.add( message = { ...(await normalizeMessageFileUpload(message)), ...{ _updatedAt: message._updatedAt } }; } - const analyticsData = getAnalyticsData(room, new Date()); + const analyticsData = isMessageFromVisitor(message) ? undefined : getAnalyticsData(room, new Date()); await LivechatRooms.getAnalyticsUpdateQueryByRoomId(room, message, analyticsData, roomUpdater); return message;