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

@@ -80,13 +80,7 @@ export const UserPrivateResponse = UserPartialResponse.extend({
.boolean()
.optional()
.describe('Whether the current email address is marked as bounced by the mail provider'),
phone: z
.string()
.nullish()
.describe(
'Always null. Retained for old-client backward compatibility — phone numbers are no longer stored on the user record.',
),
has_verified_phone: z.boolean().describe('Whether this account has completed phone verification'),
has_verified_phone: z.boolean().describe('Deprecated. Always false.'),
bio: z.string().nullable().describe('The user biography text'),
pronouns: z.string().nullable().describe('The preferred pronouns of the user'),
accent_color: Int32Type.nullable().describe('The user-selected accent color as an integer'),
@@ -107,6 +101,7 @@ export const UserPrivateResponse = UserPartialResponse.extend({
.optional()
.describe('The types of authenticators configured for MFA'),
verified: z.boolean().describe('Whether the email address has been verified'),
account_limited: z.boolean().optional().describe('Whether the account is limited'),
premium_type: withFieldDescription(UserPremiumTypesSchema, 'The type of premium subscription').nullable(),
premium_since: z.string().nullable().describe('ISO8601 timestamp of when premium was first activated'),
premium_until: z
@@ -134,10 +129,6 @@ export const UserPrivateResponse = UserPartialResponse.extend({
premium_purchase_disabled: z.boolean().describe('Whether premium purchases are disabled for this account'),
premium_enabled_override: z.boolean().describe('Whether premium features are enabled via override'),
premium_perks_disabled: z.boolean().describe('Whether premium perks are temporarily disabled for this account'),
force_inbound_phone_verification: z
.boolean()
.optional()
.describe('Whether this account is forced through the inbound phone verification flow, for debugging'),
password_last_changed_at: z.string().nullable().describe('ISO8601 timestamp of the last password change'),
last_voice_activity_sharing_change_at: z
.string()
@@ -145,7 +136,7 @@ export const UserPrivateResponse = UserPartialResponse.extend({
.describe(
'ISO8601 timestamp of the last bulk voice-activity-sharing change. Drives the 24-hour cooldown for re-toggling the Active Now sharing default.',
),
required_actions: z.array(z.string()).describe('Actions the user must complete before full access'),
required_actions: z.array(z.string()).describe('Deprecated. Always empty.'),
nsfw_allowed: z.boolean().describe('Whether the user is allowed to view NSFW content'),
has_dismissed_premium_onboarding: z.boolean().describe('Whether the user has dismissed the premium onboarding flow'),
has_ever_purchased: z.boolean().describe('Whether the user has ever made a purchase'),
@@ -411,17 +402,6 @@ export const RelationshipResponse = z.object({
});
export type RelationshipResponse = z.infer<typeof RelationshipResponse>;
export type RequiredAction =
| 'REQUIRE_VERIFIED_EMAIL'
| 'REQUIRE_REVERIFIED_EMAIL'
| 'REQUIRE_VERIFIED_PHONE'
| 'REQUIRE_REVERIFIED_PHONE'
| 'REQUIRE_VERIFIED_EMAIL_OR_VERIFIED_PHONE'
| 'REQUIRE_REVERIFIED_EMAIL_OR_VERIFIED_PHONE'
| 'REQUIRE_VERIFIED_EMAIL_OR_REVERIFIED_PHONE'
| 'REQUIRE_REVERIFIED_EMAIL_OR_REVERIFIED_PHONE'
| 'REQUIRE_INBOUND_PHONE_VERIFICATION';
export interface BackupCode {
readonly code: string;
readonly consumed: boolean;
@@ -453,10 +433,10 @@ export interface UserPrivate extends UserPartial, UserProfile {
readonly email: string | null;
readonly email_bounced?: boolean;
readonly mfa_enabled: boolean;
readonly phone?: string | null;
readonly has_verified_phone: boolean;
readonly authenticator_types: ReadonlyArray<number>;
readonly verified: boolean;
readonly account_limited?: boolean;
readonly premium_type: number | null;
readonly premium_since: string | null;
readonly premium_until: string | null;
@@ -472,12 +452,11 @@ export interface UserPrivate extends UserPartial, UserProfile {
readonly premium_purchase_disabled: boolean;
readonly premium_enabled_override: boolean;
readonly premium_perks_disabled: boolean;
readonly force_inbound_phone_verification?: boolean;
readonly timezone?: string | null;
readonly timezone_privacy_flags?: number;
readonly password_last_changed_at: string | null;
readonly last_voice_activity_sharing_change_at: string | null;
readonly required_actions: ReadonlyArray<RequiredAction>;
readonly required_actions: ReadonlyArray<string>;
readonly nsfw_allowed: boolean;
readonly pending_bulk_message_deletion: PendingBulkMessageDeletion | null;
readonly has_dismissed_premium_onboarding: boolean;
@@ -645,17 +624,4 @@ export const BulkIgnoreFriendRequestsResponse = z.object({
export type BulkIgnoreFriendRequestsResponse = z.infer<typeof BulkIgnoreFriendRequestsResponse>;
const PhoneGateEscapeGuildResponse = z.object({
id: SnowflakeStringType.describe('The unique identifier (snowflake) for the community'),
name: z.string().describe('The community name'),
});
export const PhoneGateEscapePreviewResponse = z.object({
available: z.boolean().describe('Whether this account can set a due phone verification requirement aside right now'),
guilds: z.array(PhoneGateEscapeGuildResponse).describe('Always empty, the escape leaves no community'),
owned_guilds: z.array(PhoneGateEscapeGuildResponse).describe('Always empty, the escape leaves no community'),
});
export type PhoneGateEscapePreviewResponse = z.infer<typeof PhoneGateEscapePreviewResponse>;
export const RelationshipListResponse = z.array(RelationshipResponse);