Skip to content

Commit

Permalink
Merge pull request #1393 from WideChat/revert_ee_changes
Browse files Browse the repository at this point in the history
[BREAK] Remove EE changes
  • Loading branch information
ear-dev authored Sep 6, 2023
2 parents df180d2 + 2e15459 commit 8e7b6cb
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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,
});

Expand Down
11 changes: 7 additions & 4 deletions apps/meteor/ee/app/livechat-enterprise/server/lib/Helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) {
Expand Down
24 changes: 5 additions & 19 deletions apps/meteor/ee/app/livechat-enterprise/server/lib/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
2 changes: 1 addition & 1 deletion apps/meteor/ee/server/services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion ee/apps/ddp-streamer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:^",
Expand Down

0 comments on commit 8e7b6cb

Please sign in to comment.