fix(api): handle null picture (#60468)

This commit is contained in:
Oliver Eyton-Williams
2025-05-21 18:50:29 +02:00
committed by GitHub
parent a008ad5152
commit 8f6a8d0401
3 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -138,7 +138,7 @@ model user {
newEmail String? // Null | Undefined
partiallyCompletedChallenges PartiallyCompletedChallenge[] // Undefined | PartiallyCompletedChallenge[]
password String? // Undefined
picture String
picture String?
portfolio Portfolio[]
profileUI ProfileUI? // Undefined
progressTimestamps Json? // ProgressTimestamp[] | Null[] | Int64[] | Double[] - TODO: NORMALIZE
+1
View File
@@ -648,6 +648,7 @@ export const userGetRoutes: FastifyPluginCallbackTypebox = (
[username]: {
...removeNulls(publicUser),
...normalizeFlags(flags),
picture: publicUser.picture ?? '',
currentChallengeId: currentChallengeId ?? '',
completedChallenges: normalizeChallenges(completedChallenges),
completedChallengeCount: completedChallenges.length,
+1
View File
@@ -191,6 +191,7 @@ export const userPublicGetRoutes: FastifyPluginCallbackTypebox = (
...removeNulls(publicUser),
...normalizeFlags(flags),
...sharedUser,
picture: user.picture ?? '',
profileUI: normalizedProfileUI,
// TODO: should this always be returned? Shouldn't some privacy
// setting control it? Same applies to website, githubProfile,