diff --git a/.changeset/tasty-goats-deny.md b/.changeset/tasty-goats-deny.md new file mode 100644 index 000000000000..37acfd035c34 --- /dev/null +++ b/.changeset/tasty-goats-deny.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': patch +--- + +This adjustment removes deprecated `livechat:addAgent` and `livechat:addManager` method. Moving forward use `livechat/users/agent` and `livechat/users/manager` endpoints to add agent and manager respectively. diff --git a/apps/meteor/app/livechat/server/index.ts b/apps/meteor/app/livechat/server/index.ts index 357d444ac474..bfb37611b148 100644 --- a/apps/meteor/app/livechat/server/index.ts +++ b/apps/meteor/app/livechat/server/index.ts @@ -17,8 +17,6 @@ import './hooks/saveLastMessageToInquiry'; import './hooks/afterUserActions'; import './hooks/afterAgentRemoved'; import './hooks/afterSaveOmnichannelMessage'; -import './methods/addAgent'; -import './methods/addManager'; import './methods/changeLivechatStatus'; import './methods/closeRoom'; import './methods/discardTranscript'; diff --git a/apps/meteor/app/livechat/server/methods/addAgent.ts b/apps/meteor/app/livechat/server/methods/addAgent.ts deleted file mode 100644 index 0551e985e18e..000000000000 --- a/apps/meteor/app/livechat/server/methods/addAgent.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { IUser } from '@rocket.chat/core-typings'; -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { Meteor } from 'meteor/meteor'; - -import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; -import { Livechat } from '../lib/LivechatTyped'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:addAgent'(username: string): Promise; - } -} - -Meteor.methods({ - async 'livechat:addAgent'(username) { - const uid = Meteor.userId(); - methodDeprecationLogger.method('livechat:addAgent', '7.0.0'); - if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-agents'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:addAgent' }); - } - - return Livechat.addAgent(username); - }, -}); diff --git a/apps/meteor/app/livechat/server/methods/addManager.ts b/apps/meteor/app/livechat/server/methods/addManager.ts deleted file mode 100644 index a954d8111773..000000000000 --- a/apps/meteor/app/livechat/server/methods/addManager.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { IUser } from '@rocket.chat/core-typings'; -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { Meteor } from 'meteor/meteor'; - -import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; -import { Livechat } from '../lib/LivechatTyped'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:addManager'(username: string): Promise; - } -} - -Meteor.methods({ - async 'livechat:addManager'(username) { - const uid = Meteor.userId(); - methodDeprecationLogger.method('livechat:addManager', '7.0.0'); - if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-managers'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:addManager' }); - } - - return Livechat.addManager(username); - }, -});