diff --git a/apps/meteor/app/lib/server/index.ts b/apps/meteor/app/lib/server/index.ts index 49fad2002c753..ecfdb2ed81cd1 100644 --- a/apps/meteor/app/lib/server/index.ts +++ b/apps/meteor/app/lib/server/index.ts @@ -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'; diff --git a/apps/meteor/app/lib/server/methods/checkUsernameAvailability.ts b/apps/meteor/app/lib/server/methods/checkUsernameAvailability.ts deleted file mode 100644 index 4df2706bb4796..0000000000000 --- a/apps/meteor/app/lib/server/methods/checkUsernameAvailability.ts +++ /dev/null @@ -1,34 +0,0 @@ -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({ - 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; - }, -});