diff --git a/.changeset/short-pots-lay.md b/.changeset/short-pots-lay.md new file mode 100644 index 0000000000000..aa14ad39ed4eb --- /dev/null +++ b/.changeset/short-pots-lay.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Removes deprecated `livechat:removeTag` method diff --git a/apps/meteor/ee/app/livechat-enterprise/server/index.ts b/apps/meteor/ee/app/livechat-enterprise/server/index.ts index a255f9aa07e94..4285ff5d01e21 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/index.ts +++ b/apps/meteor/ee/app/livechat-enterprise/server/index.ts @@ -4,7 +4,6 @@ import { Meteor } from 'meteor/meteor'; import './methods/addMonitor'; import './methods/removeMonitor'; -import './methods/removeTag'; import './methods/saveTag'; import './methods/removeUnit'; import './methods/saveUnit'; diff --git a/apps/meteor/ee/app/livechat-enterprise/server/methods/removeTag.ts b/apps/meteor/ee/app/livechat-enterprise/server/methods/removeTag.ts deleted file mode 100644 index 9e97eadaa1a9c..0000000000000 --- a/apps/meteor/ee/app/livechat-enterprise/server/methods/removeTag.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:removeTag'(id: string): Promise; - } -} - -Meteor.methods({ - async 'livechat:removeTag'(id) { - methodDeprecationLogger.method('livechat:removeTag', '8.0.0', '/v1/livechat/tags.delete'); - const uid = Meteor.userId(); - if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-tags'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:removeTag' }); - } - - check(id, String); - return (await LivechatEnterprise.removeTag(id)).deletedCount > 0; - }, -}); diff --git a/apps/meteor/tests/data/livechat/tags.ts b/apps/meteor/tests/data/livechat/tags.ts index 68387a83f2ec1..8dcbcf5e77a89 100644 --- a/apps/meteor/tests/data/livechat/tags.ts +++ b/apps/meteor/tests/data/livechat/tags.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker'; import type { ILivechatTag } from '@rocket.chat/core-typings'; -import { credentials, methodCall, request } from '../api-data'; +import { api, credentials, methodCall, request } from '../api-data'; import type { DummyResponse } from './utils'; export const saveTags = (departments: string[] = []): Promise => { @@ -29,21 +29,14 @@ export const saveTags = (departments: string[] = []): Promise => { export const removeTag = (id: string): Promise => { return new Promise((resolve, reject) => { void request - .post(methodCall(`livechat:removeTag`)) + .post(api('livechat/tags.delete')) .set(credentials) - .send({ - message: JSON.stringify({ - method: 'livechat:removeTag', - params: [id], - id: '101', - msg: 'method', - }), - }) + .send({ id }) .end((err: Error, res: DummyResponse) => { if (err) { return reject(err); } - resolve(JSON.parse(res.body.message).result); + resolve(JSON.parse(res.body.success).result); }); }); };