mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(api): handle null picture (#60468)
This commit is contained in:
committed by
GitHub
parent
a008ad5152
commit
8f6a8d0401
@@ -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
|
||||
|
||||
@@ -648,6 +648,7 @@ export const userGetRoutes: FastifyPluginCallbackTypebox = (
|
||||
[username]: {
|
||||
...removeNulls(publicUser),
|
||||
...normalizeFlags(flags),
|
||||
picture: publicUser.picture ?? '',
|
||||
currentChallengeId: currentChallengeId ?? '',
|
||||
completedChallenges: normalizeChallenges(completedChallenges),
|
||||
completedChallengeCount: completedChallenges.length,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user