diff --git a/.changeset/purple-tools-heal.md b/.changeset/purple-tools-heal.md new file mode 100644 index 0000000000000..069703865c4d1 --- /dev/null +++ b/.changeset/purple-tools-heal.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Removed deprecated methods `livechat:removeAgent`, `livechat:removeManager` and `livechat:removeDepartment`. Moving forward, use `livechat/users/agent/:_id`, and `livechat/users/manager/:_id` and `livechat/department/:_id` respectively.` diff --git a/apps/meteor/app/livechat/server/index.ts b/apps/meteor/app/livechat/server/index.ts index 651fbdbcfa69b..4e78811505d77 100644 --- a/apps/meteor/app/livechat/server/index.ts +++ b/apps/meteor/app/livechat/server/index.ts @@ -25,11 +25,8 @@ import './methods/getAnalyticsOverviewData'; import './methods/getNextAgent'; import './methods/getRoutingConfig'; import './methods/registerGuest'; -import './methods/removeAgent'; import './methods/removeAllClosedRooms'; import './methods/removeCustomField'; -import './methods/removeDepartment'; -import './methods/removeManager'; import './methods/removeTrigger'; import './methods/removeRoom'; import './methods/saveAgentInfo'; diff --git a/apps/meteor/app/livechat/server/methods/removeAgent.ts b/apps/meteor/app/livechat/server/methods/removeAgent.ts deleted file mode 100644 index ebb57383784f0..0000000000000 --- a/apps/meteor/app/livechat/server/methods/removeAgent.ts +++ /dev/null @@ -1,27 +0,0 @@ -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:removeAgent'(username: string): boolean; - } -} - -Meteor.methods({ - async 'livechat:removeAgent'(username) { - methodDeprecationLogger.method('livechat:removeAgent', '7.0.0'); - const uid = Meteor.userId(); - if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-agents'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { - method: 'livechat:removeAgent', - }); - } - - return Livechat.removeAgent(username); - }, -}); diff --git a/apps/meteor/app/livechat/server/methods/removeDepartment.ts b/apps/meteor/app/livechat/server/methods/removeDepartment.ts deleted file mode 100644 index 6e4b11c836f67..0000000000000 --- a/apps/meteor/app/livechat/server/methods/removeDepartment.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { check } from 'meteor/check'; -import { Meteor } from 'meteor/meteor'; -import type { DeleteResult } from 'mongodb'; - -import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; -import { DepartmentHelper } from '../lib/Departments'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:removeDepartment'(_id: string): DeleteResult; - } -} - -Meteor.methods({ - async 'livechat:removeDepartment'(_id) { - methodDeprecationLogger.method('livechat:removeDepartment', '7.0.0'); - - check(_id, String); - - const uid = Meteor.userId(); - - if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-departments'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { - method: 'livechat:removeDepartment', - }); - } - - return DepartmentHelper.removeDepartment(_id); - }, -}); diff --git a/apps/meteor/app/livechat/server/methods/removeManager.ts b/apps/meteor/app/livechat/server/methods/removeManager.ts deleted file mode 100644 index 85a5f3076c8c3..0000000000000 --- a/apps/meteor/app/livechat/server/methods/removeManager.ts +++ /dev/null @@ -1,29 +0,0 @@ -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:removeManager'(username: string): boolean; - } -} - -Meteor.methods({ - async 'livechat:removeManager'(username) { - methodDeprecationLogger.method('livechat:removeManager', '7.0.0'); - - const uid = Meteor.userId(); - - if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-managers'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { - method: 'livechat:removeManager', - }); - } - - return Livechat.removeManager(username); - }, -});