fix(api): handle when emailVerified is null (#60429)

This commit is contained in:
Oliver Eyton-Williams
2025-05-19 13:18:10 +02:00
committed by GitHub
parent 00264908e8
commit a5ec9e1ee7
2 changed files with 4 additions and 2 deletions

View File

@@ -612,6 +612,7 @@ export const userGetRoutes: FastifyPluginCallbackTypebox = (
const [flags, rest] = splitUser(user);
const {
emailVerified,
username,
usernameDisplay,
completedChallenges,
@@ -639,13 +640,14 @@ export const userGetRoutes: FastifyPluginCallbackTypebox = (
calendar: getCalendar(
progressTimestamps as ProgressTimestamp[] | null
),
emailVerified: !!emailVerified,
// This assertion is necessary until the database is normalized.
points: getPoints(
progressTimestamps as ProgressTimestamp[] | null
),
profileUI: normalizeProfileUI(profileUI),
// TODO(Post-MVP) remove this and just use emailVerified
isEmailVerified: user.emailVerified,
isEmailVerified: !!emailVerified,
joinDate: new ObjectId(user.id).getTimestamp().toISOString(),
location: location ?? '',
name: name ?? '',