From 2e15459b0c1928d5a177b91f0f4309767f341f58 Mon Sep 17 00:00:00 2001 From: Aditya Bhardwaj Date: Thu, 17 Aug 2023 20:43:59 +0530 Subject: [PATCH] Remove EE changes --- .../server/lib/AutoCloseOnHoldScheduler.ts | 3 +-- .../server/lib/AutoTransferChatScheduler.ts | 3 +-- .../livechat-enterprise/server/lib/Helper.js | 11 +++++---- .../server/lib/QueueInactivityMonitor.ts | 3 +-- .../server/lib/VisitorInactivityMonitor.js | 11 --------- .../livechat-enterprise/server/lib/logger.ts | 24 ++++--------------- apps/meteor/ee/server/services/package.json | 2 +- ee/apps/ddp-streamer/package.json | 2 +- 8 files changed, 17 insertions(+), 42 deletions(-) diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/AutoCloseOnHoldScheduler.ts b/apps/meteor/ee/app/livechat-enterprise/server/lib/AutoCloseOnHoldScheduler.ts index 592ef0474f6f..3d782764a3a7 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/AutoCloseOnHoldScheduler.ts +++ b/apps/meteor/ee/app/livechat-enterprise/server/lib/AutoCloseOnHoldScheduler.ts @@ -6,7 +6,6 @@ import moment from 'moment'; import { Livechat } from '../../../../../app/livechat/server'; import { LivechatRooms, Users } from '../../../../../app/models/server'; -const { MONGO_URL = 'mongodb://localhost:27017/rocketchat' } = process.env; const schedulerUser = Users.findOneById('rocket.cat'); const SCHEDULER_NAME = 'omnichannel_auto_close_on_hold_scheduler'; @@ -22,7 +21,7 @@ class AutoCloseOnHoldSchedulerClass { this.scheduler = new Agenda({ mongo: (MongoInternals.defaultRemoteCollectionDriver().mongo as any).client.db(), - db: { address: MONGO_URL, collection: SCHEDULER_NAME }, + db: { collection: SCHEDULER_NAME }, defaultConcurrency: 1, }); diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/AutoTransferChatScheduler.ts b/apps/meteor/ee/app/livechat-enterprise/server/lib/AutoTransferChatScheduler.ts index 413048fe5a37..dca87efc6465 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/AutoTransferChatScheduler.ts +++ b/apps/meteor/ee/app/livechat-enterprise/server/lib/AutoTransferChatScheduler.ts @@ -8,7 +8,6 @@ import { Livechat } from '../../../../../app/livechat/server'; import { RoutingManager } from '../../../../../app/livechat/server/lib/RoutingManager'; import { forwardRoomToAgent } from '../../../../../app/livechat/server/lib/Helper'; -const { MONGO_URL = 'mongodb://localhost:27017/rocketchat' } = process.env; const schedulerUser = Users.findOneById('rocket.cat'); const SCHEDULER_NAME = 'omnichannel_scheduler'; @@ -26,7 +25,7 @@ class AutoTransferChatSchedulerClass { this.scheduler = new Agenda({ mongo: (MongoInternals.defaultRemoteCollectionDriver().mongo as any).client.db(), - db: { address: MONGO_URL, collection: SCHEDULER_NAME }, + db: { collection: SCHEDULER_NAME }, defaultConcurrency: 1, }); diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/Helper.js b/apps/meteor/ee/app/livechat-enterprise/server/lib/Helper.js index 58a1b80b8760..88a4592a5944 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/Helper.js +++ b/apps/meteor/ee/app/livechat-enterprise/server/lib/Helper.js @@ -143,7 +143,12 @@ export const processWaitingQueue = async (department, inquiry) => { }; export const setPredictedVisitorAbandonmentTime = async (room) => { - if (!room.v || !settings.get('Livechat_abandoned_rooms_action') || settings.get('Livechat_abandoned_rooms_action') === 'none') { + if ( + !room.v || + !room.v.lastMessageTs || + !settings.get('Livechat_abandoned_rooms_action') || + settings.get('Livechat_abandoned_rooms_action') === 'none' + ) { return; } @@ -158,9 +163,7 @@ export const setPredictedVisitorAbandonmentTime = async (room) => { return; } - const willBeAbandonedAt = moment(room.v.lastMessageTs ?? room.lastMessage?.ts) - .add(Number(secondsToAdd), 'seconds') - .toDate(); + const willBeAbandonedAt = moment(room.v.lastMessageTs).add(Number(secondsToAdd), 'seconds').toDate(); LivechatRooms.setPredictedVisitorAbandonment(room._id, willBeAbandonedAt); }; diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/QueueInactivityMonitor.ts b/apps/meteor/ee/app/livechat-enterprise/server/lib/QueueInactivityMonitor.ts index 292f98652e19..f9962cdaaff1 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/QueueInactivityMonitor.ts +++ b/apps/meteor/ee/app/livechat-enterprise/server/lib/QueueInactivityMonitor.ts @@ -10,7 +10,6 @@ import { Logger } from '../../../../../app/logger/server'; import { LivechatRooms, Users, LivechatInquiry } from '../../../../../app/models/server'; import { Livechat } from '../../../../../app/livechat/server/lib/Livechat'; -const { MONGO_URL = 'mongodb://localhost:27017/rocketchat' } = process.env; const SCHEDULER_NAME = 'omnichannel_queue_inactivity_monitor'; export class OmnichannelQueueInactivityMonitorClass { @@ -37,7 +36,7 @@ export class OmnichannelQueueInactivityMonitorClass { this.logger = new Logger('QueueInactivityMonitor'); this.scheduler = new Agenda({ mongo: (MongoInternals.defaultRemoteCollectionDriver().mongo as any).client.db(), - db: { address: MONGO_URL, collection: SCHEDULER_NAME }, + db: { collection: SCHEDULER_NAME }, defaultConcurrency: 1, }); this.createIndex(); diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/VisitorInactivityMonitor.js b/apps/meteor/ee/app/livechat-enterprise/server/lib/VisitorInactivityMonitor.js index de0ac8c9f665..e4b229803133 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/VisitorInactivityMonitor.js +++ b/apps/meteor/ee/app/livechat-enterprise/server/lib/VisitorInactivityMonitor.js @@ -4,7 +4,6 @@ import { Meteor } from 'meteor/meteor'; import { LivechatVisitors } from '@rocket.chat/models'; import { settings } from '../../../../../app/settings/server'; -import { SNS } from '../../../../../app/livechat/server/lib/SNS'; import { LivechatRooms, LivechatDepartment, Users } from '../../../../../app/models/server'; import { Livechat } from '../../../../../app/livechat/server/lib/Livechat'; import { LivechatEnterprise } from './LivechatEnterprise'; @@ -78,16 +77,6 @@ export class VisitorInactivityMonitor { room, user: this.user, }); - SNS.sendEvent({ - roomId: room._id, - category: 'Chat Session', - action: 'closed', - eventType: 'session', - timestamp: new Date().toISOString(), - properties: { - close_method: 'visitor_abandonment', - }, - }); } async placeRoomOnHold(room) { diff --git a/apps/meteor/ee/app/livechat-enterprise/server/lib/logger.ts b/apps/meteor/ee/app/livechat-enterprise/server/lib/logger.ts index f74385217171..22d26754f321 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/lib/logger.ts +++ b/apps/meteor/ee/app/livechat-enterprise/server/lib/logger.ts @@ -2,22 +2,8 @@ import { Logger } from '../../../../../app/logger/server'; export const logger = new Logger('LivechatEnterprise'); -// WIDECHAT -const dummyLogger = { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - debug: (..._args: any[]): void => { - // We don't need to log this because it spams elastic search with too many unnecessary logs - }, -}; - -export const queriesLogger = dummyLogger; -export const queueLogger = dummyLogger; -export const helperLogger = dummyLogger; -export const cbLogger = dummyLogger; -export const bhLogger = dummyLogger; - -// export const queriesLogger = logger.section('Queries'); -// export const queueLogger = logger.section('Queue'); -// export const helperLogger = logger.section('Helper'); -// export const cbLogger = logger.section('Callbacks'); -// export const bhLogger = logger.section('Business-Hours'); +export const queriesLogger = logger.section('Queries'); +export const queueLogger = logger.section('Queue'); +export const helperLogger = logger.section('Helper'); +export const cbLogger = logger.section('Callbacks'); +export const bhLogger = logger.section('Business-Hours'); diff --git a/apps/meteor/ee/server/services/package.json b/apps/meteor/ee/server/services/package.json index f606679bc19c..dac31faf170a 100644 --- a/apps/meteor/ee/server/services/package.json +++ b/apps/meteor/ee/server/services/package.json @@ -22,7 +22,7 @@ "author": "Rocket.Chat", "license": "MIT", "dependencies": { - "@rocket.chat/apps-engine": "WideChat/Rocket.Chat.Apps-engine.git#v1.34.0.widechat-1", + "@rocket.chat/apps-engine": "^1.32.0", "@rocket.chat/core-typings": "workspace:^", "@rocket.chat/emitter": "0.31.18", "@rocket.chat/message-parser": "0.31.18", diff --git a/ee/apps/ddp-streamer/package.json b/ee/apps/ddp-streamer/package.json index 68e38f3b0b82..01639c2924f3 100644 --- a/ee/apps/ddp-streamer/package.json +++ b/ee/apps/ddp-streamer/package.json @@ -14,7 +14,7 @@ ], "author": "Rocket.Chat", "dependencies": { - "@rocket.chat/apps-engine": "WideChat/Rocket.Chat.Apps-engine.git#v1.34.0.widechat-1", + "@rocket.chat/apps-engine": "^1.32.0", "@rocket.chat/core-typings": "workspace:^", "@rocket.chat/emitter": "0.31.18", "@rocket.chat/model-typings": "workspace:^",