chore!: removes deprecated method livechat:removeBusinessHour (#37819)

This commit is contained in:
Lucas Pelegrino 2025-12-15 16:54:04 -03:00 committed by Guilherme Gazzo
parent d769c9080a
commit 4c55c57a00
3 changed files with 5 additions and 29 deletions

View File

@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---
Removes deprecated method `livechat:removeBusinessHour`

View File

@ -2,7 +2,6 @@ import { License } from '@rocket.chat/license';
import { patchOmniCore } from '@rocket.chat/omni-core-ee';
import { Meteor } from 'meteor/meteor';
import './methods/removeBusinessHour';
import './hooks/afterTakeInquiry';
import './hooks/beforeNewInquiry';
import './hooks/beforeNewRoom';

View File

@ -1,28 +0,0 @@
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { Meteor } from 'meteor/meteor';
import { hasPermissionAsync } from '../../../../../app/authorization/server/functions/hasPermission';
import { methodDeprecationLogger } from '../../../../../app/lib/server/lib/deprecationWarningLogger';
import { businessHourManager } from '../../../../../app/livechat/server/business-hour';
declare module '@rocket.chat/ddp-client' {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
'livechat:removeBusinessHour'(id: string, type: string): void;
}
}
Meteor.methods<ServerMethods>({
async 'livechat:removeBusinessHour'(id: string, type: string) {
methodDeprecationLogger.method('livechat:removeBusinessHour', '8.0.0', '/v1/livechat/business-hours.remove');
const userId = Meteor.userId();
if (!userId || !(await hasPermissionAsync(userId, 'view-livechat-business-hours'))) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
method: 'livechat:removeBusinessHour',
});
}
return businessHourManager.removeBusinessHourByIdAndType(id, type);
},
});