From 210478f7e12f83287839802dd0b3f1164479e5ba Mon Sep 17 00:00:00 2001 From: Abhinav Kumar Date: Thu, 3 Oct 2024 20:23:05 +0530 Subject: [PATCH] chore!: removed deprecated livechat:getNextAgent method Signed-off-by: Abhinav Kumar --- .changeset/large-pillows-brush.md | 5 ++ apps/meteor/app/livechat/server/index.ts | 1 - .../livechat/server/methods/getNextAgent.ts | 49 ------------------- 3 files changed, 5 insertions(+), 50 deletions(-) create mode 100644 .changeset/large-pillows-brush.md delete mode 100644 apps/meteor/app/livechat/server/methods/getNextAgent.ts diff --git a/.changeset/large-pillows-brush.md b/.changeset/large-pillows-brush.md new file mode 100644 index 0000000000000..b598126bf105c --- /dev/null +++ b/.changeset/large-pillows-brush.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Removed deprecated method `livechat:getNextAgent`. Moving forward, use the `livechat/agent.next/:token` endpoint. diff --git a/apps/meteor/app/livechat/server/index.ts b/apps/meteor/app/livechat/server/index.ts index 38462ef56c844..2c838cfe4894d 100644 --- a/apps/meteor/app/livechat/server/index.ts +++ b/apps/meteor/app/livechat/server/index.ts @@ -24,7 +24,6 @@ import './methods/getAgentData'; import './methods/getAgentOverviewData'; import './methods/getAnalyticsChartData'; import './methods/getAnalyticsOverviewData'; -import './methods/getNextAgent'; import './methods/getRoutingConfig'; import './methods/pageVisited'; import './methods/registerGuest'; diff --git a/apps/meteor/app/livechat/server/methods/getNextAgent.ts b/apps/meteor/app/livechat/server/methods/getNextAgent.ts deleted file mode 100644 index f603aeef97f34..0000000000000 --- a/apps/meteor/app/livechat/server/methods/getNextAgent.ts +++ /dev/null @@ -1,49 +0,0 @@ -import type { ILivechatAgent } from '@rocket.chat/core-typings'; -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { LivechatRooms, Users } from '@rocket.chat/models'; -import { check } from 'meteor/check'; -import { Meteor } from 'meteor/meteor'; - -import { callbacks } from '../../../../lib/callbacks'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; -import { settings } from '../../../settings/server'; -import { Livechat } from '../lib/LivechatTyped'; -import { RoutingManager } from '../lib/RoutingManager'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:getNextAgent'(params: { - token: string; - department?: string; - }): Promise | undefined | null>; - } -} - -Meteor.methods({ - async 'livechat:getNextAgent'({ token, department }) { - methodDeprecationLogger.method('livechat:getNextAgent', '7.0.0'); - check(token, String); - - const extraQuery = await callbacks.run('livechat.applyRoomRestrictions', {}); - const room = await LivechatRooms.findOpenByVisitorToken(token, {}, extraQuery).toArray(); - - if (room && room.length > 0) { - return; - } - - if (!department) { - const requireDepartment = await Livechat.getRequiredDepartment(); - if (requireDepartment) { - department = requireDepartment._id; - } - } - - const agent = await RoutingManager.getNextAgent(department); - if (!agent) { - return; - } - - return Users.getAgentInfo(agent.agentId, settings.get('Livechat_show_agent_email')); - }, -});