mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-07 15:03:20 -04:00
fix(api): remove legacy get-session-user endpoint (#67089)
This commit is contained in:
@@ -187,7 +187,7 @@ const lockedProfileUI = {
|
||||
};
|
||||
|
||||
// These are not part of the schema, but are added to the user object by
|
||||
// get-session-user's handler
|
||||
// session-user's handler
|
||||
const computedProperties = {
|
||||
calendar: {},
|
||||
completedChallengeCount: 0,
|
||||
@@ -198,7 +198,7 @@ const computedProperties = {
|
||||
profileUI: lockedProfileUI
|
||||
};
|
||||
|
||||
// The following appears in get-session-user responses, but not
|
||||
// The following appears in session-user responses, but not
|
||||
// get-public-profile
|
||||
const sessionOnlyData = {
|
||||
currentChallengeId: testUserData.currentChallengeId,
|
||||
@@ -1639,16 +1639,6 @@ Thanks and regards,
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(response.body).toStrictEqual({ user: {}, result: '' });
|
||||
});
|
||||
|
||||
test('GET legacy endpoint returns 200 with empty user object for unauthenticated users', async () => {
|
||||
const response = await superRequest('/user/get-session-user', {
|
||||
method: 'GET',
|
||||
setCookies
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(response.body).toStrictEqual({ user: {}, result: '' });
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -837,14 +837,6 @@ export const userGetRoutes: FastifyPluginCallbackTypebox = (
|
||||
}
|
||||
};
|
||||
|
||||
fastify.get(
|
||||
'/user/get-session-user',
|
||||
{
|
||||
schema: schemas.getSessionUser
|
||||
},
|
||||
getSessionUserHandler
|
||||
);
|
||||
|
||||
fastify.get(
|
||||
'/user/session-user',
|
||||
{
|
||||
|
||||
@@ -391,7 +391,7 @@ describe('userRoutes', () => {
|
||||
expect(response.statusCode).toBe(200);
|
||||
});
|
||||
// TODO: create a list of public properties like the api-server and use that
|
||||
// to restrict the output of this and get-session-user.
|
||||
// to restrict the output of this and session-user.
|
||||
test('returns 200 status code with public user object', async () => {
|
||||
const testUser =
|
||||
await fastifyTestInstance.prisma.user.findFirstOrThrow({
|
||||
|
||||
Reference in New Issue
Block a user