-
Notifications
You must be signed in to change notification settings - Fork 211
Prod hotfix - Get off of v3jwt and fix MM related issues #7140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Auth0 updates to avoid v3jwt usage
Auth0 - Let's try this
Another test build fix
CORE-2300 fixes
| store.auth | ||
| </code> | ||
|
|
||
| of Redux store, or in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[❗❗ correctness]
The change from v3jwt to tcjwt in the authentication token lookup might affect the authentication flow. Ensure that tcjwt is the correct and intended token to use in all contexts where this code is executed.
| }; | ||
|
|
||
| const getSubmissionCreatedTime = (submission) => { | ||
| if (!submission) return undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[correctness]
The function getSubmissionCreatedTime returns undefined if submission is falsy. Consider returning null instead to explicitly indicate the absence of a value, which is more semantically correct and can prevent potential issues when this function's output is used elsewhere.
| case 'Time': { | ||
| valueA = new Date(a.submissionTime); | ||
| valueB = new Date(b.submissionTime); | ||
| valueA = new Date(getSubmissionCreatedTime(a)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[❗❗ correctness]
When creating a new Date object with getSubmissionCreatedTime, ensure that the returned value is a valid date string or timestamp. If getSubmissionCreatedTime returns undefined, new Date(undefined) will result in an invalid date object, which could lead to unexpected behavior.
| const statusLabel = isAccepted ? 'Accepted' : 'In Queue'; | ||
| const displaySubmissionId = getDisplaySubmissionId(mySubmission); | ||
| const submissionCreatedTime = getSubmissionCreatedTime(mySubmission); | ||
| const submissionTimeDisplay = submissionCreatedTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[❗❗ correctness]
Consider handling the case where submissionCreatedTime is an invalid date. Using moment with an invalid date will result in 'Invalid date' being displayed. Ensure that getSubmissionCreatedTime returns a valid date or handle the invalid case explicitly.
| ); | ||
| let mmSubmissions = extractArrayFromStateSlice(state.challenge.mmSubmissions, challengeId); | ||
| if (!mmSubmissions.length && reviewSummations.length) { | ||
| mmSubmissions = buildMmSubmissionData(reviewSummations); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[correctness]
The function buildMmSubmissionData is called without checking if reviewSummations is an array. Consider adding a check to ensure reviewSummations is an array before calling this function to prevent potential runtime errors.
| const { auth } = state; | ||
| let statisticsData = extractArrayFromStateSlice(state.challenge.statisticsData, challengeId); | ||
| if ((!Array.isArray(statisticsData) || !statisticsData.length) && reviewSummations.length) { | ||
| statisticsData = buildStatisticsData(reviewSummations); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[correctness]
The function buildStatisticsData is called without checking if reviewSummations is an array. Consider adding a check to ensure reviewSummations is an array before calling this function to prevent potential runtime errors.
| state.challenge.reviewSummations, | ||
| challengeId, | ||
| ); | ||
| let mmSubmissions = extractArrayFromStateSlice(state.challenge.mmSubmissions, challengeId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[correctness]
The variable mmSubmissions is reassigned with the result of buildMmSubmissionData without checking if reviewSummations is an array. Consider adding a check to ensure reviewSummations is an array before reassigning mmSubmissions to prevent potential runtime errors.
| } | ||
| const { auth } = state; | ||
| let statisticsData = extractArrayFromStateSlice(state.challenge.statisticsData, challengeId); | ||
| if ((!Array.isArray(statisticsData) || !statisticsData.length) && reviewSummations.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[correctness]
The variable statisticsData is reassigned with the result of buildStatisticsData without checking if reviewSummations is an array. Consider adding a check to ensure reviewSummations is an array before reassigning statisticsData to prevent potential runtime errors.
CORE-2300 / PM-2959