mirror of
https://github.com/RocketChat/Rocket.Chat.git
synced 2025-12-28 06:47:25 +00:00
chore!: Remove deprecated setCustomFields method (#36832)
This commit is contained in:
parent
04d24848bd
commit
0414771335
5
.changeset/nasty-beans-breathe.md
Normal file
5
.changeset/nasty-beans-breathe.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@rocket.chat/meteor": major
|
||||
---
|
||||
|
||||
Removes the deprecated `setCustomFields` method
|
||||
@ -46,7 +46,6 @@ import './methods/setUsername';
|
||||
import './methods/unarchiveRoom';
|
||||
import './methods/unblockUser';
|
||||
import './methods/updateMessage';
|
||||
import './methods/saveCustomFields';
|
||||
import './methods/checkFederationConfiguration';
|
||||
|
||||
export * from './lib';
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
import type { IUser } from '@rocket.chat/core-typings';
|
||||
import type { ServerMethods } from '@rocket.chat/ddp-client';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
|
||||
import { saveCustomFields } from '../functions/saveCustomFields';
|
||||
import { RateLimiter } from '../lib';
|
||||
import { methodDeprecationLogger } from '../lib/deprecationWarningLogger';
|
||||
|
||||
declare module '@rocket.chat/ddp-client' {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
interface ServerMethods {
|
||||
saveCustomFields: (fields: IUser['customFields']) => Promise<void>;
|
||||
}
|
||||
}
|
||||
|
||||
Meteor.methods<ServerMethods>({
|
||||
async saveCustomFields(fields = {}) {
|
||||
methodDeprecationLogger.method('saveCustomFields', '8.0.0', 'Use the endpoint /v1/users.updateOwnBasicInfo instead');
|
||||
const uid = Meteor.userId();
|
||||
if (!uid) {
|
||||
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'saveCustomFields' });
|
||||
}
|
||||
await saveCustomFields(uid, fields);
|
||||
},
|
||||
});
|
||||
|
||||
RateLimiter.limitMethod('saveCustomFields', 1, 1000, {
|
||||
userId() {
|
||||
return true;
|
||||
},
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user