mirror of
https://github.com/RocketChat/Rocket.Chat.git
synced 2025-12-28 06:47:25 +00:00
chore!: remove deprecated removeCannedResponse method (#37446)
This commit is contained in:
parent
2498d14a5f
commit
655bee706e
5
.changeset/smooth-birds-crash.md
Normal file
5
.changeset/smooth-birds-crash.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'@rocket.chat/meteor': major
|
||||
---
|
||||
|
||||
Removes deprecated `removeCannedResponse` method
|
||||
@ -1,19 +1,10 @@
|
||||
import type { ServerMethods } from '@rocket.chat/ddp-client';
|
||||
import { CannedResponse } from '@rocket.chat/models';
|
||||
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 notifications from '../../../../../app/notifications/server/lib/Notifications';
|
||||
|
||||
declare module '@rocket.chat/ddp-client' {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
interface ServerMethods {
|
||||
removeCannedResponse(_id: string): Promise<void>;
|
||||
}
|
||||
}
|
||||
|
||||
export const removeCannedResponse = async (uid: string, _id: string): Promise<void> => {
|
||||
if (!(await hasPermissionAsync(uid, 'remove-canned-responses'))) {
|
||||
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
|
||||
@ -34,18 +25,3 @@ export const removeCannedResponse = async (uid: string, _id: string): Promise<vo
|
||||
|
||||
await CannedResponse.removeById(_id);
|
||||
};
|
||||
|
||||
Meteor.methods<ServerMethods>({
|
||||
async removeCannedResponse(_id) {
|
||||
methodDeprecationLogger.method('removeCannedResponse', '8.0.0', 'DELETE /v1/canned-responses/:_id');
|
||||
const uid = Meteor.userId();
|
||||
|
||||
if (!uid) {
|
||||
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
|
||||
method: 'removeCannedResponse',
|
||||
});
|
||||
}
|
||||
|
||||
return removeCannedResponse(uid, _id);
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user