From 61294eec0cf39b9e09a0c10c1122cba1e739112e Mon Sep 17 00:00:00 2001 From: Martin Schoeler Date: Thu, 4 Sep 2025 18:06:14 -0300 Subject: [PATCH] chore!: Remove deprecated livechat methods & api endpoints (#36836) --- .changeset/chatty-lizards-reflect.md | 13 +++++++ apps/meteor/app/livechat/server/index.ts | 3 -- .../getDepartmentForwardRestrictions.ts | 28 --------------- .../server/methods/getFirstRoomMessage.ts | 36 ------------------- .../livechat/server/methods/getTagsList.ts | 26 -------------- .../app/livechat-enterprise/server/index.ts | 1 - .../server/methods/getUnitsFromUserRoles.ts | 23 ------------ 7 files changed, 13 insertions(+), 117 deletions(-) create mode 100644 .changeset/chatty-lizards-reflect.md delete mode 100644 apps/meteor/app/livechat/server/methods/getDepartmentForwardRestrictions.ts delete mode 100644 apps/meteor/app/livechat/server/methods/getFirstRoomMessage.ts delete mode 100644 apps/meteor/app/livechat/server/methods/getTagsList.ts delete mode 100644 apps/meteor/ee/app/livechat-enterprise/server/methods/getUnitsFromUserRoles.ts diff --git a/.changeset/chatty-lizards-reflect.md b/.changeset/chatty-lizards-reflect.md new file mode 100644 index 00000000000..17f269cb70a --- /dev/null +++ b/.changeset/chatty-lizards-reflect.md @@ -0,0 +1,13 @@ +--- +"@rocket.chat/meteor": major +"@rocket.chat/ddp-client": major +--- + +Removes the deprecated livechat:getTagsList method + +Removes the deprecated livechat:getUnitsFromUser method + +Removes the deprecated livechat:getFirstRoomMessage method + +Removes the deprecated livechat:getDepartmentForwardRestrictions method + diff --git a/apps/meteor/app/livechat/server/index.ts b/apps/meteor/app/livechat/server/index.ts index 6f8b8ad0cdc..252a5110d2e 100644 --- a/apps/meteor/app/livechat/server/index.ts +++ b/apps/meteor/app/livechat/server/index.ts @@ -29,9 +29,6 @@ import './methods/setUpConnection'; import './methods/takeInquiry'; import './methods/returnAsInquiry'; import './methods/sendTranscript'; -import './methods/getFirstRoomMessage'; -import './methods/getTagsList'; -import './methods/getDepartmentForwardRestrictions'; import './lib/QueueManager'; import './lib/RoutingManager'; import './lib/routing/External'; diff --git a/apps/meteor/app/livechat/server/methods/getDepartmentForwardRestrictions.ts b/apps/meteor/app/livechat/server/methods/getDepartmentForwardRestrictions.ts deleted file mode 100644 index 2a895fa6ed0..00000000000 --- a/apps/meteor/app/livechat/server/methods/getDepartmentForwardRestrictions.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { Meteor } from 'meteor/meteor'; - -import { callbacks } from '../../../../server/lib/callbacks'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:getDepartmentForwardRestrictions'(departmentId: string): unknown; - } -} - -Meteor.methods({ - async 'livechat:getDepartmentForwardRestrictions'(departmentId) { - methodDeprecationLogger.method('livechat:getDepartmentForwardRestrictions', '7.0.0', 'This functionality is no longer supported'); - if (!Meteor.userId()) { - throw new Meteor.Error('error-invalid-user', 'Invalid user', { - method: 'livechat:getDepartmentForwardRestrictions', - }); - } - - const options = await callbacks.run('livechat.onLoadForwardDepartmentRestrictions', { departmentId }); - const { restrictions } = options; - - return restrictions; - }, -}); diff --git a/apps/meteor/app/livechat/server/methods/getFirstRoomMessage.ts b/apps/meteor/app/livechat/server/methods/getFirstRoomMessage.ts deleted file mode 100644 index e929e3f39ec..00000000000 --- a/apps/meteor/app/livechat/server/methods/getFirstRoomMessage.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { LivechatRooms, Messages } from '@rocket.chat/models'; -import { check } from 'meteor/check'; -import { Meteor } from 'meteor/meteor'; - -import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:getFirstRoomMessage'(params: { rid: string }): unknown; - } -} - -Meteor.methods({ - async 'livechat:getFirstRoomMessage'({ rid }) { - const uid = Meteor.userId(); - methodDeprecationLogger.method('livechat:getFirsRoomMessage', '7.0.0', 'This functionality is no longer supported'); - if (!uid || !(await hasPermissionAsync(uid, 'view-l-room'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { - method: 'livechat:getFirstRoomMessage', - }); - } - - check(rid, String); - - const room = await LivechatRooms.findOneById(rid); - - if (!room || room.t !== 'l') { - throw new Meteor.Error('error-invalid-room', 'Invalid room'); - } - - return Messages.findOne({ rid }, { sort: { ts: 1 } }); - }, -}); diff --git a/apps/meteor/app/livechat/server/methods/getTagsList.ts b/apps/meteor/app/livechat/server/methods/getTagsList.ts deleted file mode 100644 index fec21543249..00000000000 --- a/apps/meteor/app/livechat/server/methods/getTagsList.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { ILivechatTag } from '@rocket.chat/core-typings'; -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { Meteor } from 'meteor/meteor'; - -import { callbacks } from '../../../../server/lib/callbacks'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:getTagsList'(): ILivechatTag[]; - } -} - -Meteor.methods({ - 'livechat:getTagsList'() { - methodDeprecationLogger.method('livechat:getTagsList', '7.0.0', 'This functionality is no longer supported'); - if (!Meteor.userId()) { - throw new Meteor.Error('error-invalid-user', 'Invalid user', { - method: 'livechat:getTagsList', - }); - } - - return callbacks.run('livechat.beforeListTags'); - }, -}); diff --git a/apps/meteor/ee/app/livechat-enterprise/server/index.ts b/apps/meteor/ee/app/livechat-enterprise/server/index.ts index 0a3a246a9a5..02a42933735 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/index.ts +++ b/apps/meteor/ee/app/livechat-enterprise/server/index.ts @@ -3,7 +3,6 @@ import { patchOmniCore } from '@rocket.chat/omni-core-ee'; import { Meteor } from 'meteor/meteor'; import './methods/addMonitor'; -import './methods/getUnitsFromUserRoles'; import './methods/removeMonitor'; import './methods/removeTag'; import './methods/saveTag'; diff --git a/apps/meteor/ee/app/livechat-enterprise/server/methods/getUnitsFromUserRoles.ts b/apps/meteor/ee/app/livechat-enterprise/server/methods/getUnitsFromUserRoles.ts deleted file mode 100644 index 7161d14cb79..00000000000 --- a/apps/meteor/ee/app/livechat-enterprise/server/methods/getUnitsFromUserRoles.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { getUnitsFromUser } from '@rocket.chat/omni-core-ee'; -import { Meteor } from 'meteor/meteor'; - -import { methodDeprecationLogger } from '../../../../../app/lib/server/lib/deprecationWarningLogger'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:getUnitsFromUser'(): Promise; - } -} - -Meteor.methods({ - async 'livechat:getUnitsFromUser'(): Promise { - methodDeprecationLogger.method('livechat:getUnitsFromUser', '8.0.0', 'This functionality is no longer supported'); - const userId = Meteor.userId(); - if (!userId) { - return; - } - return getUnitsFromUser(userId); - }, -});