Skip to content
Snippets Groups Projects
Commit 449029c1 authored by Abhinav Kumar's avatar Abhinav Kumar Committed by Guilherme Gazzo
Browse files

chore!: remove livechat:addAgent and livechat:addManager method (#33372)

parent 2511b8b3
No related branches found
No related tags found
No related merge requests found
---
'@rocket.chat/meteor': patch
---
This adjustment removes deprecated `livechat:addAgent` and `livechat:addManager` method. Moving forward use `livechat/users/agent` and `livechat/users/manager` endpoints to add agent and manager respectively.
......@@ -17,8 +17,6 @@ import './hooks/saveLastMessageToInquiry';
import './hooks/afterUserActions';
import './hooks/afterAgentRemoved';
import './hooks/afterSaveOmnichannelMessage';
import './methods/addAgent';
import './methods/addManager';
import './methods/changeLivechatStatus';
import './methods/closeRoom';
import './methods/discardTranscript';
......
import type { IUser } from '@rocket.chat/core-typings';
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:addAgent'(username: string): Promise<false | IUser>;
}
}
Meteor.methods<ServerMethods>({
async 'livechat:addAgent'(username) {
const uid = Meteor.userId();
methodDeprecationLogger.method('livechat:addAgent', '7.0.0');
if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-agents'))) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:addAgent' });
}
return Livechat.addAgent(username);
},
});
import type { IUser } from '@rocket.chat/core-typings';
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:addManager'(username: string): Promise<false | IUser>;
}
}
Meteor.methods<ServerMethods>({
async 'livechat:addManager'(username) {
const uid = Meteor.userId();
methodDeprecationLogger.method('livechat:addManager', '7.0.0');
if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-managers'))) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:addManager' });
}
return Livechat.addManager(username);
},
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment