mirror of
https://github.com/RocketChat/Rocket.Chat.git
synced 2025-12-28 06:47:25 +00:00
chore!: remove deprecated livechat:returnAsInquiry method (#37392)
This commit is contained in:
parent
e00a6b08f6
commit
740de58aff
5
.changeset/five-months-shake.md
Normal file
5
.changeset/five-months-shake.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'@rocket.chat/meteor': major
|
||||
---
|
||||
|
||||
Removes deprecated `livechat:returnAsInquiry` method
|
||||
@ -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';
|
||||
|
||||
@ -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);
|
||||
},
|
||||
});
|
||||
@ -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);
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user