chore!: remove deprecated livechat:removeUnit method (#37460)

This commit is contained in:
Júlia Jaeger Foresti 2025-11-11 09:26:48 -03:00 committed by Guilherme Gazzo
parent 5e9f357b73
commit 7461db65cb
4 changed files with 6 additions and 32 deletions

View File

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

View File

@ -5,7 +5,6 @@ import { Meteor } from 'meteor/meteor';
import './methods/addMonitor';
import './methods/removeMonitor';
import './methods/saveTag';
import './methods/removeUnit';
import './methods/removeBusinessHour';
import './hooks/afterTakeInquiry';
import './hooks/beforeNewInquiry';

View File

@ -1,27 +0,0 @@
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { check } from 'meteor/check';
import { Meteor } from 'meteor/meteor';
import { hasPermissionAsync } from '../../../../../app/authorization/server/functions/hasPermission';
import { methodDeprecationLogger } from '../../../../../app/lib/server/lib/deprecationWarningLogger';
import { LivechatEnterprise } from '../lib/LivechatEnterprise';
declare module '@rocket.chat/ddp-client' {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
'livechat:removeUnit'(id: string): boolean;
}
}
Meteor.methods<ServerMethods>({
async 'livechat:removeUnit'(id) {
methodDeprecationLogger.method('livechat:removeUnit', '8.0.0', 'DELETE /v1/livechat/units/:id');
const uid = Meteor.userId();
if (!uid || !(await hasPermissionAsync(uid, 'manage-livechat-units'))) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:removeUnit' });
}
check(id, String);
return (await LivechatEnterprise.removeUnit(id, uid)).deletedCount > 0;
},
});

View File

@ -10,10 +10,7 @@ type CreateUnitParams = {
departments?: { departmentId: string }[];
};
const removeUnit = async (api: BaseTest['api'], id: string) =>
api.post('/method.call/omnichannel:removeUnit', {
message: JSON.stringify({ msg: 'method', id: '35', method: 'livechat:removeUnit', params: [id] }),
});
const removeUnit = async (api: BaseTest['api'], id: string) => api.delete(`/livechat/units/${id}`);
export const createOrUpdateUnit = async (
api: BaseTest['api'],