mirror of
https://github.com/RocketChat/Rocket.Chat.git
synced 2025-12-27 22:40:49 +00:00
chore!: Remove deprecated livechat methods & api endpoints (#36836)
This commit is contained in:
parent
0fe1d48023
commit
61294eec0c
13
.changeset/chatty-lizards-reflect.md
Normal file
13
.changeset/chatty-lizards-reflect.md
Normal 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
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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;
|
||||
},
|
||||
});
|
||||
@ -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 } });
|
||||
},
|
||||
});
|
||||
@ -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');
|
||||
},
|
||||
});
|
||||
@ -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';
|
||||
|
||||
@ -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);
|
||||
},
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user