diff --git a/.changeset/blue-beans-check.md b/.changeset/blue-beans-check.md new file mode 100644 index 00000000000..f1d66153e3f --- /dev/null +++ b/.changeset/blue-beans-check.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Removes deprecated `livechat:removeUnit` method diff --git a/apps/meteor/ee/app/livechat-enterprise/server/index.ts b/apps/meteor/ee/app/livechat-enterprise/server/index.ts index 321c4602153..5464f8cb876 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/index.ts +++ b/apps/meteor/ee/app/livechat-enterprise/server/index.ts @@ -5,7 +5,6 @@ import { Meteor } from 'meteor/meteor'; import './methods/addMonitor'; import './methods/removeMonitor'; import './methods/saveTag'; -import './methods/removeUnit'; import './methods/removeBusinessHour'; import './hooks/afterTakeInquiry'; import './hooks/beforeNewInquiry'; diff --git a/apps/meteor/ee/app/livechat-enterprise/server/methods/removeUnit.ts b/apps/meteor/ee/app/livechat-enterprise/server/methods/removeUnit.ts deleted file mode 100644 index 4ebd58a7a5e..00000000000 --- a/apps/meteor/ee/app/livechat-enterprise/server/methods/removeUnit.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { check } from 'meteor/check'; -import { Meteor } from 'meteor/meteor'; - -import { hasPermissionAsync } from '../../../../../app/authorization/server/functions/hasPermission'; -import { methodDeprecationLogger } from '../../../../../app/lib/server/lib/deprecationWarningLogger'; -import { LivechatEnterprise } from '../lib/LivechatEnterprise'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:removeUnit'(id: string): boolean; - } -} - -Meteor.methods({ - async 'livechat:removeUnit'(id) { - methodDeprecationLogger.method('livechat:removeUnit', '8.0.0', 'DELETE /v1/livechat/units/:id'); - const uid = Meteor.userId(); - if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-units'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:removeUnit' }); - } - - check(id, String); - return (await LivechatEnterprise.removeUnit(id, uid)).deletedCount > 0; - }, -}); diff --git a/apps/meteor/tests/e2e/utils/omnichannel/units.ts b/apps/meteor/tests/e2e/utils/omnichannel/units.ts index 9427d8beafe..e302475ee37 100644 --- a/apps/meteor/tests/e2e/utils/omnichannel/units.ts +++ b/apps/meteor/tests/e2e/utils/omnichannel/units.ts @@ -10,10 +10,7 @@ type CreateUnitParams = { departments?: { departmentId: string }[]; }; -const removeUnit = async (api: BaseTest['api'], id: string) => - api.post('/method.call/omnichannel:removeUnit', { - message: JSON.stringify({ msg: 'method', id: '35', method: 'livechat:removeUnit', params: [id] }), - }); +const removeUnit = async (api: BaseTest['api'], id: string) => api.delete(`/livechat/units/${id}`); export const createOrUpdateUnit = async ( api: BaseTest['api'],