diff --git a/.changeset/thick-guests-compete.md b/.changeset/thick-guests-compete.md new file mode 100644 index 0000000000000..20b7fb8ca0405 --- /dev/null +++ b/.changeset/thick-guests-compete.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Removes deprecated `livechat:saveAgentInfo` method diff --git a/apps/meteor/app/livechat/server/index.ts b/apps/meteor/app/livechat/server/index.ts index 18d7dfb7062a8..9aafa268cc800 100644 --- a/apps/meteor/app/livechat/server/index.ts +++ b/apps/meteor/app/livechat/server/index.ts @@ -16,7 +16,6 @@ import './hooks/afterAgentRemoved'; import './hooks/afterSaveOmnichannelMessage'; import './methods/removeCustomField'; import './methods/removeRoom'; -import './methods/saveAgentInfo'; import './methods/saveCustomField'; import './methods/saveDepartment'; import './methods/sendMessageLivechat'; diff --git a/apps/meteor/app/livechat/server/methods/saveAgentInfo.ts b/apps/meteor/app/livechat/server/methods/saveAgentInfo.ts deleted file mode 100644 index 3e761efa352b6..0000000000000 --- a/apps/meteor/app/livechat/server/methods/saveAgentInfo.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { Meteor } from 'meteor/meteor'; - -import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; -import { hasRoleAsync } from '../../../authorization/server/functions/hasRole'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; -import { saveAgentInfo } from '../lib/omni-users'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:saveAgentInfo'(_id: string, agentData: Record, agentDepartments: string[]): unknown; - } -} - -Meteor.methods({ - async 'livechat:saveAgentInfo'(_id, agentData, agentDepartments) { - methodDeprecationLogger.method('livechat:saveAgentInfo', '8.0.0', '/v1/livechat/agents.saveInfo'); - check(_id, String); - check(agentData, Object); - check(agentDepartments, [String]); - - const user = await Meteor.userAsync(); - if (!user || !(await hasPermissionAsync(user._id, 'manage-livechat-agents'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { - method: 'livechat:saveAgentInfo', - }); - } - - if (!(await hasRoleAsync(_id, 'livechat-agent'))) { - throw new Meteor.Error('error-user-is-not-agent', 'User is not a livechat agent', { - method: 'livechat:saveAgentInfo', - }); - } - - return saveAgentInfo(_id, agentData, agentDepartments); - }, -});