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