diff --git a/.changeset/five-months-shake.md b/.changeset/five-months-shake.md new file mode 100644 index 0000000000000..b694672c84358 --- /dev/null +++ b/.changeset/five-months-shake.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Removes deprecated `livechat:returnAsInquiry` method diff --git a/apps/meteor/app/livechat/server/index.ts b/apps/meteor/app/livechat/server/index.ts index 9aafa268cc800..96d5d56874f6a 100644 --- a/apps/meteor/app/livechat/server/index.ts +++ b/apps/meteor/app/livechat/server/index.ts @@ -22,7 +22,6 @@ import './methods/sendMessageLivechat'; import './methods/sendFileLivechatMessage'; import './methods/setUpConnection'; import './methods/takeInquiry'; -import './methods/returnAsInquiry'; import './methods/sendTranscript'; import './lib/QueueManager'; import './lib/RoutingManager'; diff --git a/apps/meteor/app/livechat/server/methods/returnAsInquiry.ts b/apps/meteor/app/livechat/server/methods/returnAsInquiry.ts deleted file mode 100644 index 40a1714955e49..0000000000000 --- a/apps/meteor/app/livechat/server/methods/returnAsInquiry.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { ILivechatDepartment, 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 { returnRoomAsInquiry } from '../lib/rooms'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:returnAsInquiry'(rid: IRoom['_id'], departmentID?: ILivechatDepartment['_id']): boolean; - } -} - -Meteor.methods({ - async 'livechat:returnAsInquiry'(rid, departmentId) { - methodDeprecationLogger.method('livechat:returnAsInquiry', '8.0.0', '/v1/livechat/inquiries.returnAsInquiry'); - const uid = Meteor.userId(); - if (!uid || !(await hasPermissionAsync(uid, 'view-l-room'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { - method: 'livechat:returnAsInquiry', - }); - } - - const room = await LivechatRooms.findOneById(rid); - if (!room || room.t !== 'l') { - throw new Meteor.Error('error-invalid-room', 'Invalid room', { - method: 'livechat:returnAsInquiry', - }); - } - - return returnRoomAsInquiry(room, departmentId); - }, -});