Skip to content
Snippets Groups Projects
Commit 4d15cb32 authored by Abhinav Kumar's avatar Abhinav Kumar Committed by Guilherme Gazzo
Browse files

chore!: removed checkUsernameAvailability method (#32488)

parent 68303048
No related branches found
Tags 6.12.0-rc.3
No related merge requests found
......@@ -13,7 +13,6 @@ import './methods/addUserToRoom';
import './methods/archiveRoom';
import './methods/blockUser';
import './methods/checkRegistrationSecretURL';
import './methods/checkUsernameAvailability';
import './methods/cleanRoomHistory';
import './methods/createChannel';
import './methods/createPrivateGroup';
......
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { check } from 'meteor/check';
import { Meteor } from 'meteor/meteor';
import { checkUsernameAvailabilityWithValidation } from '../functions/checkUsernameAvailability';
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 {
checkUsernameAvailability(username: string): boolean;
}
}
Meteor.methods<ServerMethods>({
async checkUsernameAvailability(username) {
methodDeprecationLogger.method('checkUsernameAvailability', '7.0.0');
check(username, String);
const userId = Meteor.userId();
if (!userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'checkUsernameAvailability' });
}
return checkUsernameAvailabilityWithValidation(userId, username);
},
});
RateLimiter.limitMethod('checkUsernameAvailability', 1, 1000, {
userId() {
return true;
},
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment