mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-20 12:03:11 -04:00
fix(api): return usernameDisplay (#61567)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@@ -140,6 +140,7 @@ const minimalUserData: Prisma.userCreateInput = {
|
||||
picture: 'https://www.freecodecamp.org/cat.png',
|
||||
sendQuincyEmail: true,
|
||||
username: 'testuser',
|
||||
usernameDisplay: 'testuser',
|
||||
unsubscribeId: '1234567890'
|
||||
};
|
||||
|
||||
@@ -276,7 +277,8 @@ const publicUserData = {
|
||||
profileUI: testUserData.profileUI,
|
||||
savedChallenges: testUserData.savedChallenges,
|
||||
twitter: 'https://twitter.com/foobar',
|
||||
username: testUserData.usernameDisplay, // It defaults to usernameDisplay
|
||||
username: testUserData.username,
|
||||
usernameDisplay: testUserData.usernameDisplay,
|
||||
website: testUserData.website,
|
||||
yearsTopContributor: testUserData.yearsTopContributor
|
||||
};
|
||||
|
||||
@@ -682,7 +682,8 @@ export const userGetRoutes: FastifyPluginCallbackTypebox = (
|
||||
name: name ?? '',
|
||||
theme: theme ?? 'default',
|
||||
twitter: normalizeTwitter(twitter),
|
||||
username: usernameDisplay || username,
|
||||
username,
|
||||
usernameDisplay: usernameDisplay || username,
|
||||
userToken: encodedToken,
|
||||
completedSurveys: normalizeSurveys(completedSurveys),
|
||||
msUsername: msUsername?.msUsername
|
||||
|
||||
@@ -206,7 +206,8 @@ const publicUserData = {
|
||||
profileUI: testUserData.profileUI,
|
||||
savedChallenges: testUserData.savedChallenges,
|
||||
twitter: 'https://twitter.com/foobar',
|
||||
username: testUserData.usernameDisplay, // It defaults to usernameDisplay
|
||||
username: testUserData.username,
|
||||
usernameDisplay: testUserData.usernameDisplay,
|
||||
website: testUserData.website,
|
||||
yearsTopContributor: testUserData.yearsTopContributor
|
||||
};
|
||||
|
||||
@@ -150,7 +150,6 @@ export const userPublicGetRoutes: FastifyPluginCallbackTypebox = (
|
||||
'unsubscribeId',
|
||||
'donationEmails',
|
||||
'externalId',
|
||||
'usernameDisplay',
|
||||
'isBanned'
|
||||
]);
|
||||
|
||||
@@ -166,7 +165,8 @@ export const userPublicGetRoutes: FastifyPluginCallbackTypebox = (
|
||||
[user.username]: {
|
||||
isLocked: true,
|
||||
profileUI: normalizedProfileUI,
|
||||
username: user.username
|
||||
username: user.username,
|
||||
usernameDisplay: user.usernameDisplay || user.username
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -197,7 +197,8 @@ export const userPublicGetRoutes: FastifyPluginCallbackTypebox = (
|
||||
// setting control it? Same applies to website, githubProfile,
|
||||
// and linkedin.
|
||||
twitter: normalizeTwitter(user.twitter),
|
||||
yearsTopContributor: user.yearsTopContributor
|
||||
yearsTopContributor: user.yearsTopContributor,
|
||||
usernameDisplay: user.usernameDisplay || user.username
|
||||
};
|
||||
return reply.send({
|
||||
// TODO(Post-MVP): just return a user object (i.e. returnedUser) and
|
||||
|
||||
@@ -117,6 +117,7 @@ export const getSessionUser = {
|
||||
joinDate: Type.String(),
|
||||
savedChallenges: Type.Optional(Type.Array(savedChallenge)),
|
||||
username: Type.String(),
|
||||
usernameDisplay: Type.String(),
|
||||
userToken: Type.Optional(Type.String()),
|
||||
completedSurveys: Type.Array(
|
||||
Type.Object({
|
||||
|
||||
@@ -102,6 +102,7 @@ export const getPublicProfile = {
|
||||
joinDate: Type.String(),
|
||||
savedChallenges: Type.Array(savedChallenge),
|
||||
username: Type.String(),
|
||||
usernameDisplay: Type.String(),
|
||||
msUsername: Type.Optional(Type.String())
|
||||
})
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user