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

chore!: remove deprecated method livechat:saveDepartmentAgents (#33446)

parent 87677420
No related branches found
No related tags found
No related merge requests found
---
'@rocket.chat/meteor': major
---
Removed deprecated method `livechat:saveDepartmentAgents`. Moving forward, use the endpoint `livechat/department/:_id/agents`.
...@@ -29,7 +29,6 @@ import './methods/removeRoom'; ...@@ -29,7 +29,6 @@ import './methods/removeRoom';
import './methods/saveAgentInfo'; import './methods/saveAgentInfo';
import './methods/saveCustomField'; import './methods/saveCustomField';
import './methods/saveDepartment'; import './methods/saveDepartment';
import './methods/saveDepartmentAgents';
import './methods/sendMessageLivechat'; import './methods/sendMessageLivechat';
import './methods/sendFileLivechatMessage'; import './methods/sendFileLivechatMessage';
import './methods/setDepartmentForVisitor'; import './methods/setDepartmentForVisitor';
......
import type { ILivechatDepartmentAgents } 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:saveDepartmentAgents'(
_id: string,
departmentAgents: Pick<ILivechatDepartmentAgents, 'agentId' | 'count' | 'order' | 'username'>[],
): boolean;
}
}
Meteor.methods<ServerMethods>({
async 'livechat:saveDepartmentAgents'(_id, departmentAgents) {
methodDeprecationLogger.method('livechat:saveDepartmentAgents', '7.0.0');
const uid = Meteor.userId();
if (!uid || !(await hasPermissionAsync(uid, 'add-livechat-department-agents'))) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
method: 'livechat:saveDepartmentAgents',
});
}
return Livechat.saveDepartmentAgents(_id, { upsert: departmentAgents });
},
});
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