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

chore!: removed deprecated methods livechat:removeAgent,...

chore!: removed deprecated methods livechat:removeAgent, livechat:removeManager, and livechat:removeDepartment (#33423)
parent fba7a3b9
No related branches found
No related tags found
No related merge requests found
---
'@rocket.chat/meteor': major
---
Removed deprecated methods `livechat:removeAgent`, `livechat:removeManager` and `livechat:removeDepartment`. Moving forward, use `livechat/users/agent/:_id`, and `livechat/users/manager/:_id` and `livechat/department/:_id` respectively.`
......@@ -25,11 +25,8 @@ import './methods/getAnalyticsOverviewData';
import './methods/getNextAgent';
import './methods/getRoutingConfig';
import './methods/registerGuest';
import './methods/removeAgent';
import './methods/removeAllClosedRooms';
import './methods/removeCustomField';
import './methods/removeDepartment';
import './methods/removeManager';
import './methods/removeTrigger';
import './methods/removeRoom';
import './methods/saveAgentInfo';
......
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:removeAgent'(username: string): boolean;
}
}
Meteor.methods<ServerMethods>({
async 'livechat:removeAgent'(username) {
methodDeprecationLogger.method('livechat:removeAgent', '7.0.0');
const uid = Meteor.userId();
if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-agents'))) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
method: 'livechat:removeAgent',
});
}
return Livechat.removeAgent(username);
},
});
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { check } from 'meteor/check';
import { Meteor } from 'meteor/meteor';
import type { DeleteResult } from 'mongodb';
import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger';
import { DepartmentHelper } from '../lib/Departments';
declare module '@rocket.chat/ddp-client' {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
'livechat:removeDepartment'(_id: string): DeleteResult;
}
}
Meteor.methods<ServerMethods>({
async 'livechat:removeDepartment'(_id) {
methodDeprecationLogger.method('livechat:removeDepartment', '7.0.0');
check(_id, String);
const uid = Meteor.userId();
if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-departments'))) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
method: 'livechat:removeDepartment',
});
}
return DepartmentHelper.removeDepartment(_id);
},
});
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:removeManager'(username: string): boolean;
}
}
Meteor.methods<ServerMethods>({
async 'livechat:removeManager'(username) {
methodDeprecationLogger.method('livechat:removeManager', '7.0.0');
const uid = Meteor.userId();
if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-managers'))) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
method: 'livechat:removeManager',
});
}
return Livechat.removeManager(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