refactor: simplify account standing and verification levels (#3130)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-02 18:17:41 +02:00
1 parent 1abde06824
commit 1ec8f31253
488 files changed
+10390 -47117

No files matched your search

+1 -19
View File
@@ -10,9 +10,9 @@ type AllErrorCodes = APIErrorCode | ValidationErrorCode;
export const ErrorCodeToI18nKey = {
[APIErrorCodes.ACCESS_DENIED]: 'permissions.missing_access',
[APIErrorCodes.ACCOUNT_LIMITED]: 'account.limited',
[APIErrorCodes.ACCOUNT_SUSPENDED_PERMANENTLY]: 'account.suspended_permanently',
[APIErrorCodes.ACCOUNT_SUSPENDED_TEMPORARILY]: 'account.suspended_temporarily',
[APIErrorCodes.ACCOUNT_SUSPICIOUS_ACTIVITY]: 'account.locked_suspicious_activity',
[APIErrorCodes.ACCOUNT_TOO_NEW_FOR_GUILD]: 'account.too_new_for_guild',
[APIErrorCodes.ACLS_MUST_BE_NON_EMPTY]: 'admin_and_system.acls_must_be_non_empty',
[APIErrorCodes.ADMIN_API_KEY_NOT_FOUND]: 'admin_and_system.admin_api_key_not_found',
@@ -114,7 +114,6 @@ export const ErrorCodeToI18nKey = {
[APIErrorCodes.GENERAL_ERROR]: 'admin_and_system.general_error',
[APIErrorCodes.GIFT_CODE_ALREADY_REDEEMED]: 'invites_and_gifts.gift_code_already_redeemed',
[APIErrorCodes.GONE]: 'http.gone',
[APIErrorCodes.GUILD_PHONE_VERIFICATION_REQUIRED]: 'account.phone_required_for_guild',
[APIErrorCodes.GUILD_TEMPLATE_INVALID]: 'channels_and_guilds.guild_template_invalid',
[APIErrorCodes.GUILD_VERIFICATION_REQUIRED]: 'account.guild_verification_required',
[APIErrorCodes.HANDOFF_CODE_EXPIRED]: 'auth_and_oauth.handoff_code_expired',
@@ -149,8 +148,6 @@ export const ErrorCodeToI18nKey = {
[APIErrorCodes.INVALID_PASSKEY_BRIDGE_NONCE]: 'auth_and_oauth.passkey_bridge_nonce_invalid',
[APIErrorCodes.INVALID_PERMISSIONS_INTEGER]: 'misc.invalid_permissions_integer',
[APIErrorCodes.INVALID_PERMISSIONS_NEGATIVE]: 'misc.invalid_permissions_negative',
[APIErrorCodes.INVALID_PHONE_NUMBER]: 'phone.invalid_number',
[APIErrorCodes.INVALID_PHONE_VERIFICATION_CODE]: 'phone.verification_code_invalid',
[ValidationErrorCodes.INVALID_PASSWORD]: 'email.invalid_or_password',
[ValidationErrorCodes.INVALID_MFA_CODE]: 'mfa_and_passkeys.invalid_mfa_code',
[ValidationErrorCodes.INVALID_SSO_AUTHORIZATION_CODE]: 'auth_and_oauth.invalid_sso_authorization_code',
@@ -176,7 +173,6 @@ export const ErrorCodeToI18nKey = {
'messages.forward_reference_requires_channel_and_message',
[APIErrorCodes.INVALID_STREAM_KEY_FORMAT]: 'calls_and_voice.invalid_stream_key_format',
[APIErrorCodes.INVALID_STREAM_THUMBNAIL_PAYLOAD]: 'calls_and_voice.invalid_stream_thumbnail_payload',
[APIErrorCodes.INVALID_SUSPICIOUS_FLAGS_FORMAT]: 'admin_and_system.invalid_suspicious_flags_format',
[APIErrorCodes.INVALID_SYSTEM_FLAG]: 'admin_and_system.invalid_system_flag',
[APIErrorCodes.INVALID_TIMESTAMP]: 'admin_and_system.invalid_timestamp',
[APIErrorCodes.INVALID_TOKEN]: 'auth_and_oauth.invalid_or_expired_authorization_token',
@@ -231,17 +227,6 @@ export const ErrorCodeToI18nKey = {
[APIErrorCodes.NOT_IMPLEMENTED]: 'http.not_implemented',
[APIErrorCodes.NSFW_CONTENT_AGE_RESTRICTED]: 'content_and_safety.nsfw_age_restricted',
[APIErrorCodes.PASSKEY_AUTHENTICATION_FAILED]: 'mfa_and_passkeys.passkey_authentication_failed',
[APIErrorCodes.PHONE_ADD_NOT_ELIGIBLE]: 'phone.add_not_eligible',
[APIErrorCodes.PHONE_ALREADY_USED]: 'phone.number_already_used',
[APIErrorCodes.PHONE_COUNTRY_NOT_SUPPORTED]: 'phone.country_not_supported',
[APIErrorCodes.PHONE_GATE_ESCAPE_UNAVAILABLE]: 'account.phone_gate_escape_unavailable',
[APIErrorCodes.PHONE_INBOUND_VERIFICATION_REQUIRED]: 'phone.inbound_verification_required',
[APIErrorCodes.PHONE_LOOKUP_UNAVAILABLE]: 'phone.lookup_unavailable',
[APIErrorCodes.PHONE_NUMBER_NOT_IN_SERVICE]: 'phone.number_not_in_service',
[APIErrorCodes.PHONE_NUMBER_NOT_MOBILE]: 'phone.number_not_mobile',
[APIErrorCodes.PHONE_RATE_LIMIT_EXCEEDED]: 'rate_limits.phone_rate_limit_exceeded',
[APIErrorCodes.PHONE_VERIFICATION_NEEDS_REVIEW]: 'phone.verification_needs_review',
[APIErrorCodes.PHONE_VERIFICATION_REQUIRED]: 'phone.verification_required',
[APIErrorCodes.PREMIUM_PURCHASE_BLOCKED]: 'premium_and_plans.no_active_subscription',
[APIErrorCodes.PREVIEW_MUST_BE_JPEG]: 'attachments_and_uploads.preview_must_be_jpeg',
[APIErrorCodes.PROCESSING_FAILED]: 'admin_and_system.processing_failed',
@@ -257,7 +242,6 @@ export const ErrorCodeToI18nKey = {
[APIErrorCodes.SERVICE_UNAVAILABLE]: 'http.service_unavailable',
[APIErrorCodes.SESSION_TOKEN_MISMATCH]: 'account.session_token_mismatch',
[APIErrorCodes.SLOWMODE_RATE_LIMITED]: 'rate_limits.slowmode_rate_limited',
[APIErrorCodes.SMS_VERIFICATION_UNAVAILABLE]: 'http.service_unavailable',
[APIErrorCodes.SSO_REQUIRED]: 'misc.invalid_request_generic',
[APIErrorCodes.STORE_BILLING_UNAVAILABLE]: 'store_billing.unavailable',
[APIErrorCodes.STORE_NOTIFICATION_UNAUTHORIZED]: 'store_billing.notification_unauthorized',
@@ -322,7 +306,6 @@ export const ErrorCodeToI18nKey = {
[APIErrorCodes.UNKNOWN_ROLE]: 'unknown_entities.unknown_role',
[APIErrorCodes.UNKNOWN_STICKER]: 'stickers_and_emojis.unknown_sticker',
[APIErrorCodes.UNKNOWN_STORE_PURCHASE]: 'store_billing.unknown_purchase',
[APIErrorCodes.UNKNOWN_SUSPICIOUS_FLAG]: 'admin_and_system.unknown_suspicious_flag',
[APIErrorCodes.UNKNOWN_USER_FLAG]: 'unknown_entities.unknown_user_flag',
[APIErrorCodes.UNKNOWN_USER]: 'unknown_entities.unknown_user',
[APIErrorCodes.UNKNOWN_VOICE_REGION]: 'calls_and_voice.unknown_voice_region',
@@ -546,7 +529,6 @@ export const ErrorCodeToI18nKey = {
'mfa_and_passkeys.must_enable_2fa_before_enforcing_for_mods',
[ValidationErrorCodes.TOTP_NOT_ENABLED]: 'mfa_and_passkeys.totp_not_enabled',
[ValidationErrorCodes.NAME_EMPTY_AFTER_NORMALIZATION]: 'names_and_normalization.name_empty_after_normalization',
[ValidationErrorCodes.PHONE_NUMBER_INVALID_FORMAT]: 'phone.number_format_required',
[ValidationErrorCodes.ROWS_IS_REQUIRED]: 'limits.rows_required',
[ValidationErrorCodes.SNOWFLAKE_OUT_OF_RANGE]: 'misc.invalid_snowflake',
[ValidationErrorCodes.STRING_LENGTH_EXACT]: 'limits.string_length_exact',