chore!: Remove deprecated livechat methods & api endpoints (#36836)

This commit is contained in:
Martin Schoeler 2025-09-04 18:06:14 -03:00 committed by Guilherme Gazzo
parent 0fe1d48023
commit 61294eec0c
7 changed files with 13 additions and 117 deletions

View File

@ -0,0 +1,13 @@
---
"@rocket.chat/meteor": major
"@rocket.chat/ddp-client": major
---
Removes the deprecated livechat:getTagsList method
Removes the deprecated livechat:getUnitsFromUser method
Removes the deprecated livechat:getFirstRoomMessage method
Removes the deprecated livechat:getDepartmentForwardRestrictions method

View File

@ -29,9 +29,6 @@ import './methods/setUpConnection';
import './methods/takeInquiry';
import './methods/returnAsInquiry';
import './methods/sendTranscript';
import './methods/getFirstRoomMessage';
import './methods/getTagsList';
import './methods/getDepartmentForwardRestrictions';
import './lib/QueueManager';
import './lib/RoutingManager';
import './lib/routing/External';

View File

@ -1,28 +0,0 @@
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { Meteor } from 'meteor/meteor';
import { callbacks } from '../../../../server/lib/callbacks';
import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger';
declare module '@rocket.chat/ddp-client' {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
'livechat:getDepartmentForwardRestrictions'(departmentId: string): unknown;
}
}
Meteor.methods<ServerMethods>({
async 'livechat:getDepartmentForwardRestrictions'(departmentId) {
methodDeprecationLogger.method('livechat:getDepartmentForwardRestrictions', '7.0.0', 'This functionality is no longer supported');
if (!Meteor.userId()) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'livechat:getDepartmentForwardRestrictions',
});
}
const options = await callbacks.run('livechat.onLoadForwardDepartmentRestrictions', { departmentId });
const { restrictions } = options;
return restrictions;
},
});

View File

@ -1,36 +0,0 @@
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { LivechatRooms, Messages } from '@rocket.chat/models';
import { check } from 'meteor/check';
import { Meteor } from 'meteor/meteor';
import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger';
declare module '@rocket.chat/ddp-client' {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
'livechat:getFirstRoomMessage'(params: { rid: string }): unknown;
}
}
Meteor.methods<ServerMethods>({
async 'livechat:getFirstRoomMessage'({ rid }) {
const uid = Meteor.userId();
methodDeprecationLogger.method('livechat:getFirsRoomMessage', '7.0.0', 'This functionality is no longer supported');
if (!uid || !(await hasPermissionAsync(uid, 'view-l-room'))) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
method: 'livechat:getFirstRoomMessage',
});
}
check(rid, String);
const room = await LivechatRooms.findOneById(rid);
if (!room || room.t !== 'l') {
throw new Meteor.Error('error-invalid-room', 'Invalid room');
}
return Messages.findOne({ rid }, { sort: { ts: 1 } });
},
});

View File

@ -1,26 +0,0 @@
import type { ILivechatTag } from '@rocket.chat/core-typings';
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { Meteor } from 'meteor/meteor';
import { callbacks } from '../../../../server/lib/callbacks';
import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger';
declare module '@rocket.chat/ddp-client' {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
'livechat:getTagsList'(): ILivechatTag[];
}
}
Meteor.methods<ServerMethods>({
'livechat:getTagsList'() {
methodDeprecationLogger.method('livechat:getTagsList', '7.0.0', 'This functionality is no longer supported');
if (!Meteor.userId()) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'livechat:getTagsList',
});
}
return callbacks.run('livechat.beforeListTags');
},
});

View File

@ -3,7 +3,6 @@ import { patchOmniCore } from '@rocket.chat/omni-core-ee';
import { Meteor } from 'meteor/meteor';
import './methods/addMonitor';
import './methods/getUnitsFromUserRoles';
import './methods/removeMonitor';
import './methods/removeTag';
import './methods/saveTag';

View File

@ -1,23 +0,0 @@
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { getUnitsFromUser } from '@rocket.chat/omni-core-ee';
import { Meteor } from 'meteor/meteor';
import { methodDeprecationLogger } from '../../../../../app/lib/server/lib/deprecationWarningLogger';
declare module '@rocket.chat/ddp-client' {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
'livechat:getUnitsFromUser'(): Promise<string[] | undefined>;
}
}
Meteor.methods<ServerMethods>({
async 'livechat:getUnitsFromUser'(): Promise<string[] | undefined> {
methodDeprecationLogger.method('livechat:getUnitsFromUser', '8.0.0', 'This functionality is no longer supported');
const userId = Meteor.userId();
if (!userId) {
return;
}
return getUnitsFromUser(userId);
},
});