-
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
Changes from all commits
8aace15
1701e0f
fc502b9
cca4bf2
2d8f1ba
aec4a7e
2eb39f1
320134b
dfe09e4
8b184d6
22c4c71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,6 +63,16 @@ const getDisplaySubmissionId = (submission) => { | |
| return ''; | ||
| }; | ||
|
|
||
| const getSubmissionCreatedTime = (submission) => { | ||
| if (!submission) return undefined; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| return ( | ||
| submission.created | ||
| || submission.createdAt | ||
| || submission.submissionTime | ||
| || submission.updated | ||
| || submission.updatedAt | ||
| ); | ||
| }; | ||
|
|
||
| class SubmissionsListView extends React.Component { | ||
| constructor(props) { | ||
|
|
@@ -73,7 +83,7 @@ class SubmissionsListView extends React.Component { | |
| statusClicked: false, | ||
| finalClicked: false, | ||
| provisionClicked: false, | ||
| timeClicked: false, | ||
| timeClicked: true, | ||
| openModal: false, | ||
| selectedSubmission: {}, | ||
| }; | ||
|
|
@@ -106,7 +116,7 @@ class SubmissionsListView extends React.Component { | |
| } = this.props; | ||
| let { field, sort } = submissionsSort; | ||
| if (!field) { | ||
| field = 'Submission ID'; | ||
| field = 'Time'; | ||
| } | ||
|
|
||
| if (!sort) { | ||
|
|
@@ -172,8 +182,8 @@ class SubmissionsListView extends React.Component { | |
| break; | ||
| } | ||
| 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 commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| valueB = new Date(getSubmissionCreatedTime(b)); | ||
| break; | ||
| } | ||
| default: | ||
|
|
@@ -444,6 +454,10 @@ class SubmissionsListView extends React.Component { | |
| const statusStyleName = isAccepted ? 'accepted' : 'queue'; | ||
| 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 commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| ? moment(submissionCreatedTime).format('MMM DD, YYYY HH:mm:ss') | ||
| : 'N/A'; | ||
| return ( | ||
| <div | ||
| key={displaySubmissionId || mySubmission.submissionId || mySubmission.id} | ||
|
|
@@ -498,7 +512,7 @@ class SubmissionsListView extends React.Component { | |
| )} | ||
| > | ||
| <div styleName="mobile-header">Time</div> | ||
| <span>{moment(mySubmission.submissionTime).format('MMM DD, YYYY HH:mm:ss')}</span> | ||
| <span>{submissionTimeDisplay}</span> | ||
| </div> | ||
| <div styleName="submission-table-column column-2-4"> | ||
| { !isTopCrowdChallenge | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -179,8 +179,8 @@ class ChallengeDetailPageContainer extends React.Component { | |
| sort: '', | ||
| }, | ||
| mySubmissionsSort: { | ||
| field: '', | ||
| sort: '', | ||
| field: 'Time', | ||
| sort: 'desc', | ||
| }, | ||
| notFoundCountryFlagUrl: {}, | ||
| viewAsTable: false, | ||
|
|
@@ -849,11 +849,43 @@ ChallengeDetailPageContainer.propTypes = { | |
| getSubmissionArtifacts: PT.func, | ||
| }; | ||
|
|
||
| function extractArrayFromStateSlice(slice, challengeId) { | ||
| if (Array.isArray(slice)) { | ||
| return slice; | ||
| } | ||
| if (slice && Array.isArray(slice.data)) { | ||
| return slice.data; | ||
| } | ||
| const key = challengeId ? String(challengeId) : null; | ||
| if (key && slice && slice[key]) { | ||
| const scoped = slice[key]; | ||
| if (Array.isArray(scoped)) { | ||
| return scoped; | ||
| } | ||
| if (scoped && Array.isArray(scoped.data)) { | ||
| return scoped.data; | ||
| } | ||
| } | ||
| return []; | ||
| } | ||
|
|
||
| function mapStateToProps(state, props) { | ||
| const challengeId = String(props.match.params.challengeId); | ||
| const cl = state.challengeListing; | ||
| const { lookup: { allCountries, reviewTypes } } = state; | ||
| let { challenge: { mmSubmissions } } = state; | ||
| const reviewSummations = extractArrayFromStateSlice( | ||
| state.challenge.reviewSummations, | ||
| challengeId, | ||
| ); | ||
| let mmSubmissions = extractArrayFromStateSlice(state.challenge.mmSubmissions, challengeId); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| if (!mmSubmissions.length && reviewSummations.length) { | ||
| mmSubmissions = buildMmSubmissionData(reviewSummations); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| } | ||
| 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 commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| statisticsData = buildStatisticsData(reviewSummations); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| } | ||
| const challenge = state.challenge.details || {}; | ||
| let mySubmissions = []; | ||
| if (challenge.registrants) { | ||
|
|
@@ -1087,7 +1119,7 @@ function mapStateToProps(state, props) { | |
| // recommendedChallenges: cl.recommendedChallenges, | ||
| // loadingRecommendedChallengesUUID: cl.loadingRecommendedChallengesUUID, | ||
| expandedTags: cl.expandedTags, | ||
| challengeId: String(props.match.params.challengeId), | ||
| challengeId, | ||
| challengesUrl: props.challengesUrl, | ||
| challengeTypesMap: state.challengeListing.challengeTypesMap, | ||
| checkpointResults: checkpoints.checkpointResults, | ||
|
|
@@ -1099,7 +1131,7 @@ function mapStateToProps(state, props) { | |
| isLoadingChallenge: Boolean(state.challenge.loadingDetailsForChallengeId), | ||
| isLoadingTerms: _.isEqual(state.terms.loadingTermsForEntity, { | ||
| type: 'challenge', | ||
| id: props.match.params.challengeId, | ||
| id: challengeId, | ||
| }), | ||
| loadingCheckpointResults: state.challenge.loadingCheckpoints, | ||
| loadingResultsForChallengeId: state.challenge.loadingResultsForChallengeId, | ||
|
|
@@ -1124,31 +1156,20 @@ function mapStateToProps(state, props) { | |
| mySubmissions, | ||
| reviewTypes, | ||
| openForRegistrationChallenges: state.challengeListing.openForRegistrationChallenges, | ||
| statisticsData: state.challenge.statisticsData, | ||
| statisticsData, | ||
| }; | ||
| } | ||
|
|
||
| const mapDispatchToProps = (dispatch) => { | ||
| const ca = communityActions.tcCommunity; | ||
| const lookupActions = actions.lookup; | ||
| const challengeActions = actions.challenge || {}; | ||
| const hasReviewSummationsActions = ( | ||
| typeof challengeActions.getReviewSummationsInit === 'function' | ||
| && typeof challengeActions.getReviewSummationsDone === 'function' | ||
| ); | ||
|
|
||
| const dispatchReviewSummations = (challengeId, tokenV3) => { | ||
| const challengeIdStr = _.toString(challengeId); | ||
| if (!challengeIdStr) { | ||
| return; | ||
| } | ||
|
|
||
| if (hasReviewSummationsActions) { | ||
| dispatch(challengeActions.getReviewSummationsInit(challengeIdStr)); | ||
| dispatch(challengeActions.getReviewSummationsDone(challengeIdStr, tokenV3)); | ||
| return; | ||
| } | ||
|
|
||
| dispatch({ | ||
| type: 'CHALLENGE/GET_REVIEW_SUMMATIONS_INIT', | ||
| payload: challengeIdStr, | ||
|
|
||
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
v3jwttotcjwtin the authentication token lookup might affect the authentication flow. Ensure thattcjwtis the correct and intended token to use in all contexts where this code is executed.