diff --git a/.changeset/plenty-flowers-help.md b/.changeset/plenty-flowers-help.md new file mode 100644 index 0000000000000..65f178303d5cc --- /dev/null +++ b/.changeset/plenty-flowers-help.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Removes deprecated `livechat:removeRoom` method diff --git a/apps/meteor/app/livechat/server/index.ts b/apps/meteor/app/livechat/server/index.ts index 9aafa268cc800..4efe3189c7092 100644 --- a/apps/meteor/app/livechat/server/index.ts +++ b/apps/meteor/app/livechat/server/index.ts @@ -15,7 +15,6 @@ import './hooks/afterUserActions'; import './hooks/afterAgentRemoved'; import './hooks/afterSaveOmnichannelMessage'; import './methods/removeCustomField'; -import './methods/removeRoom'; import './methods/saveCustomField'; import './methods/saveDepartment'; import './methods/sendMessageLivechat'; diff --git a/apps/meteor/app/livechat/server/methods/removeRoom.ts b/apps/meteor/app/livechat/server/methods/removeRoom.ts deleted file mode 100644 index bfe38121782ef..0000000000000 --- a/apps/meteor/app/livechat/server/methods/removeRoom.ts +++ /dev/null @@ -1,47 +0,0 @@ -import type { IRoom } from '@rocket.chat/core-typings'; -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { LivechatRooms } from '@rocket.chat/models'; -import { Meteor } from 'meteor/meteor'; - -import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; -import { removeOmnichannelRoom } from '../lib/rooms'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:removeRoom'(rid: IRoom['_id']): void; - } -} - -Meteor.methods({ - async 'livechat:removeRoom'(rid) { - methodDeprecationLogger.method('livechat:removeRoom', '8.0.0', '/v1/livechat/rooms.delete'); - const user = Meteor.userId(); - if (!user || !(await hasPermissionAsync(user, 'remove-closed-livechat-room'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:removeRoom' }); - } - - const room = await LivechatRooms.findOneById(rid); - - if (!room) { - throw new Meteor.Error('error-invalid-room', 'Invalid room', { - method: 'livechat:removeRoom', - }); - } - - if (room.t !== 'l') { - throw new Meteor.Error('error-this-is-not-a-livechat-room', 'This is not a Livechat room', { - method: 'livechat:removeRoom', - }); - } - - if (room.open) { - throw new Meteor.Error('error-room-is-not-closed', 'Room is not closed', { - method: 'livechat:removeRoom', - }); - } - - await removeOmnichannelRoom(rid); - }, -});