chore!: remove deprecated livechat:returnAsInquiry method (#37392)

This commit is contained in:
Júlia Jaeger Foresti 2025-11-05 19:47:59 -03:00 committed by Guilherme Gazzo
parent e00a6b08f6
commit 740de58aff
4 changed files with 7 additions and 46 deletions

View File

@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': major
---
Removes deprecated `livechat:returnAsInquiry` method

View File

@ -21,7 +21,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';

View File

@ -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<ServerMethods>({
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);
},
});

View File

@ -487,16 +487,9 @@ export const placeRoomOnHold = async (roomId: string): Promise<void> => {
export const moveBackToQueue = async (roomId: string, overrideCredentials?: Credentials): Promise<void> => {
await request
.post(methodCall('livechat:returnAsInquiry'))
.post(api('livechat/inquiries.returnAsInquiry'))
.set(overrideCredentials || credentials)
.send({
message: JSON.stringify({
method: 'livechat:returnAsInquiry',
params: [roomId],
id: 'id',
msg: 'method',
}),
})
.send({ roomId })
.expect('Content-Type', 'application/json')
.expect(200);
};