From dec8676c3bfa16115253db036b423ad219dc00a0 Mon Sep 17 00:00:00 2001 From: lunarkid <4476442+dedywahyudi@users.noreply.github.com> Date: Thu, 22 Sep 2022 21:21:46 +0700 Subject: [PATCH 1/6] fix: private challenge message --- src/actions/errors.js | 2 +- src/reducers/challenge.js | 5 +++-- src/reducers/errors.js | 2 +- src/utils/errors.js | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/actions/errors.js b/src/actions/errors.js index f88a39a5..7821c6be 100644 --- a/src/actions/errors.js +++ b/src/actions/errors.js @@ -14,7 +14,7 @@ import { createActions } from 'redux-actions'; export default createActions({ ERRORS: { CLEAR_ERROR: _.noop, - NEW_ERROR: (title, details) => ({ title, details }), + NEW_ERROR: (title, details, support) => ({ title, details, support }), CLEAR_ALL_ERROR_ICONS: _.noop, SET_ERROR_ICON: (id, title, message) => ({ id, title, message }), CLEAR_ERROR_ICON: id => ({ id }), diff --git a/src/reducers/challenge.js b/src/reducers/challenge.js index d6df61d3..69f5f814 100644 --- a/src/reducers/challenge.js +++ b/src/reducers/challenge.js @@ -55,8 +55,9 @@ function onGetDetailsDone(state, action) { if (action.payload.message === 'Forbidden') { fireErrorMessage( 'ERROR: Private challenge', - 'This challenge is only available to those in a private group.' - + ' It looks like you do not have access to this challenge.', + 'The challenge is only available to those in a private group.' + + ' It looks like you are not part of the group.', + 'Please work with the challenge creator to get yourself added to the group.', ); } else { fireErrorMessage( diff --git a/src/reducers/errors.js b/src/reducers/errors.js index e2b93070..70d025c7 100644 --- a/src/reducers/errors.js +++ b/src/reducers/errors.js @@ -30,7 +30,7 @@ function create(initialState) { [a.clearError]: state => ({ ...state, alerts: state.alerts.slice(1) }), [a.newError]: (state, { payload }) => ({ ...state, - alerts: [...state.alerts, { title: payload.title, details: payload.details }], + alerts: [...state.alerts, { title: payload.title, details: payload.details, support: payload.support }], }), [a.clearAllErrorIcons]: state => ({ ...state, diff --git a/src/utils/errors.js b/src/utils/errors.js index 2ffc8f1a..5b252837 100644 --- a/src/utils/errors.js +++ b/src/utils/errors.js @@ -22,10 +22,10 @@ export function setErrorsStore(s) { * The function behaves similarly to javascript alert() * it will show a modal error diaglog with styling until the user clicks OK. */ -export function fireErrorMessage(title, details) { +export function fireErrorMessage(title, details, support) { if (isomorphy.isClientSide() && store) { setImmediate(() => { - store.dispatch(actions.errors.newError(title, details)); + store.dispatch(actions.errors.newError(title, details, support)); }); } } From ca3660f96863632e0a8968276b5a94a0df696723 Mon Sep 17 00:00:00 2001 From: lunarkid <4476442+dedywahyudi@users.noreply.github.com> Date: Thu, 22 Sep 2022 22:23:16 +0700 Subject: [PATCH 2/6] fix: 100 max-len --- src/reducers/errors.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/reducers/errors.js b/src/reducers/errors.js index 70d025c7..153d105f 100644 --- a/src/reducers/errors.js +++ b/src/reducers/errors.js @@ -30,6 +30,7 @@ function create(initialState) { [a.clearError]: state => ({ ...state, alerts: state.alerts.slice(1) }), [a.newError]: (state, { payload }) => ({ ...state, + // eslint-disable-next-line max-len alerts: [...state.alerts, { title: payload.title, details: payload.details, support: payload.support }], }), [a.clearAllErrorIcons]: state => ({ From d856e723bbc59c05692224afe416dc70a96a8750 Mon Sep 17 00:00:00 2001 From: lunarkid <4476442+dedywahyudi@users.noreply.github.com> Date: Fri, 23 Sep 2022 09:59:31 +0700 Subject: [PATCH 3/6] ci: set test-release --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0e161844..e8eac28e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,7 +28,7 @@ jobs: - attach_workspace: at: . - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - - run: npm publish + - run: npm publish --tag test-release # dont change anything workflows: version: 2 From 2bbd984f4099fb47987bfa22a17b0cb5193af300 Mon Sep 17 00:00:00 2001 From: Luiz Ricardo Rodrigues Date: Fri, 23 Sep 2022 04:08:20 -0300 Subject: [PATCH 4/6] fix: PROD-2948 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5d0825f6..5ee87d4e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .", "test": "npm run lint && npm run jest" }, - "version": "1.2.10", + "version": "1000.29.10", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From e436ee4fa7a39442ccb7f09a19982d391f5cc7a2 Mon Sep 17 00:00:00 2001 From: lunarkid <4476442+dedywahyudi@users.noreply.github.com> Date: Fri, 23 Sep 2022 14:21:02 +0700 Subject: [PATCH 5/6] fix: change version to 1000.29.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5d0825f6..5ee87d4e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .", "test": "npm run lint && npm run jest" }, - "version": "1.2.10", + "version": "1000.29.10", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 56db857341e6f55cd2cf84ef169118359601de29 Mon Sep 17 00:00:00 2001 From: lunarkid <4476442+dedywahyudi@users.noreply.github.com> Date: Tue, 27 Sep 2022 23:28:42 +0700 Subject: [PATCH 6/6] fix: private message only for topgear --- __tests__/__snapshots__/index.js.snap | 1 + .../reducers/__snapshots__/challenge.js.snap | 36 +++++++++++++++++++ package.json | 2 +- src/actions/challenge.js | 11 ++++++ src/reducers/challenge.js | 36 +++++++++++++++---- 5 files changed, 79 insertions(+), 7 deletions(-) diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index 322e47a7..d2f25ce2 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -30,6 +30,7 @@ Object { "loadResultsInit": [Function], "registerDone": [Function], "registerInit": [Function], + "setCommunityId": [Function], "toggleCheckpointFeedback": [Function], "unregisterDone": [Function], "unregisterInit": [Function], diff --git a/__tests__/reducers/__snapshots__/challenge.js.snap b/__tests__/reducers/__snapshots__/challenge.js.snap index e744b7c2..15f8f80b 100644 --- a/__tests__/reducers/__snapshots__/challenge.js.snap +++ b/__tests__/reducers/__snapshots__/challenge.js.snap @@ -3,6 +3,7 @@ exports[`Default reducer Creates expected intial state 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": null, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", @@ -25,6 +26,7 @@ Object { exports[`Default reducer Handles CHALLENGE/GET_DETAILS_DONE as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -51,6 +53,7 @@ Object { exports[`Default reducer Handles CHALLENGE/GET_DETAILS_DONE with error as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -77,6 +80,7 @@ Object { exports[`Default reducer Handles CHALLENGE/GET_DETAILS_INIT as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": null, "fetchChallengeFailure": false, "loadingCheckpoints": false, @@ -100,6 +104,7 @@ Object { exports[`Default reducer Handles deleteSubmissionDone as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -132,6 +137,7 @@ Object { exports[`Default reducer Handles fetchSubmissionsDone as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -166,6 +172,7 @@ Object { exports[`Default reducer Handles fetchSubmissionsDoneError as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -198,6 +205,7 @@ Object { exports[`Default reducer Handles fetchSubmissionsInit as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -229,6 +237,7 @@ exports[`Default reducer Handles getActiveChallengesCountDone as expected 1`] = Object { "activeChallengesCount": 5, "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -261,6 +270,7 @@ Object { exports[`Factory with server-side rendering Creates expected intial state 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -295,6 +305,7 @@ Object { exports[`Factory with server-side rendering Handles CHALLENGE/GET_DETAILS_DONE as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -329,6 +340,7 @@ Object { exports[`Factory with server-side rendering Handles CHALLENGE/GET_DETAILS_DONE with error as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -363,6 +375,7 @@ Object { exports[`Factory with server-side rendering Handles CHALLENGE/GET_DETAILS_INIT as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -397,6 +410,7 @@ Object { exports[`Factory with server-side rendering Handles deleteSubmissionDone as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -429,6 +443,7 @@ Object { exports[`Factory with server-side rendering Handles fetchSubmissionsDone as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -463,6 +478,7 @@ Object { exports[`Factory with server-side rendering Handles fetchSubmissionsDoneError as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -495,6 +511,7 @@ Object { exports[`Factory with server-side rendering Handles fetchSubmissionsInit as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -526,6 +543,7 @@ exports[`Factory with server-side rendering Handles getActiveChallengesCountDone Object { "activeChallengesCount": 5, "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -558,6 +576,7 @@ Object { exports[`Factory without http request Creates expected intial state 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": null, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", @@ -580,6 +599,7 @@ Object { exports[`Factory without http request Handles CHALLENGE/GET_DETAILS_DONE as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -606,6 +626,7 @@ Object { exports[`Factory without http request Handles CHALLENGE/GET_DETAILS_DONE with error as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -632,6 +653,7 @@ Object { exports[`Factory without http request Handles CHALLENGE/GET_DETAILS_INIT as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": null, "fetchChallengeFailure": false, "loadingCheckpoints": false, @@ -655,6 +677,7 @@ Object { exports[`Factory without http request Handles deleteSubmissionDone as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -687,6 +710,7 @@ Object { exports[`Factory without http request Handles fetchSubmissionsDone as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -721,6 +745,7 @@ Object { exports[`Factory without http request Handles fetchSubmissionsDoneError as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -753,6 +778,7 @@ Object { exports[`Factory without http request Handles fetchSubmissionsInit as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -784,6 +810,7 @@ exports[`Factory without http request Handles getActiveChallengesCountDone as ex Object { "activeChallengesCount": 5, "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -816,6 +843,7 @@ Object { exports[`Factory without server-side rendering Creates expected intial state 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": null, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", @@ -838,6 +866,7 @@ Object { exports[`Factory without server-side rendering Handles CHALLENGE/GET_DETAILS_DONE as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -864,6 +893,7 @@ Object { exports[`Factory without server-side rendering Handles CHALLENGE/GET_DETAILS_DONE with error as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -890,6 +920,7 @@ Object { exports[`Factory without server-side rendering Handles CHALLENGE/GET_DETAILS_INIT as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": null, "fetchChallengeFailure": false, "loadingCheckpoints": false, @@ -913,6 +944,7 @@ Object { exports[`Factory without server-side rendering Handles deleteSubmissionDone as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -945,6 +977,7 @@ Object { exports[`Factory without server-side rendering Handles fetchSubmissionsDone as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -979,6 +1012,7 @@ Object { exports[`Factory without server-side rendering Handles fetchSubmissionsDoneError as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -1011,6 +1045,7 @@ Object { exports[`Factory without server-side rendering Handles fetchSubmissionsInit as expected 1`] = ` Object { "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", @@ -1042,6 +1077,7 @@ exports[`Factory without server-side rendering Handles getActiveChallengesCountD Object { "activeChallengesCount": 5, "checkpoints": null, + "communityId": null, "details": Object { "id": 123456789, "tag": "v3-normalized-details", diff --git a/package.json b/package.json index 5ee87d4e..87a7bdd3 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .", "test": "npm run lint && npm run jest" }, - "version": "1000.29.10", + "version": "1000.29.11", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", diff --git a/src/actions/challenge.js b/src/actions/challenge.js index 9a1c048f..39d264c6 100644 --- a/src/actions/challenge.js +++ b/src/actions/challenge.js @@ -392,6 +392,16 @@ function getSubmissionInformationDone(challengeId, submissionId, tokenV3) { }); } +/** + * @static + * @desc Creates an action that gets communityId + * @param {String} communityId The communityId + * @return {Action} + */ +function setCommunityId(communityId) { + return { communityId: _.toString(communityId) }; +} + /** * @static * @desc Creates an action that signals beginning of fetching challenge statistics @@ -415,6 +425,7 @@ export default createActions({ CHALLENGE: { DROP_CHECKPOINTS: dropCheckpoints, DROP_RESULTS: dropResults, + SET_COMMUNITY_ID: setCommunityId, FETCH_CHECKPOINTS_INIT: fetchCheckpointsInit, FETCH_CHECKPOINTS_DONE: fetchCheckpointsDone, GET_DETAILS_INIT: getDetailsInit, diff --git a/src/reducers/challenge.js b/src/reducers/challenge.js index 69f5f814..58209d32 100644 --- a/src/reducers/challenge.js +++ b/src/reducers/challenge.js @@ -53,12 +53,20 @@ function onGetDetailsDone(state, action) { if (action.error) { logger.error('Failed to get challenge details!', action.payload); if (action.payload.message === 'Forbidden') { - fireErrorMessage( - 'ERROR: Private challenge', - 'The challenge is only available to those in a private group.' - + ' It looks like you are not part of the group.', - 'Please work with the challenge creator to get yourself added to the group.', - ); + if (state.communityId === 'wipro') { + fireErrorMessage( + 'ERROR: Private challenge', + 'The challenge is only available to those in a private group.' + + ' It looks like you are not part of the group.', + 'Please work with the challenge creator to get yourself added to the group.', + ); + } else { + fireErrorMessage( + 'ERROR: Private challenge', + 'This challenge is only available to those in a private group.' + + ' It looks like you do not have access to this challenge.', + ); + } } else { fireErrorMessage( 'ERROR: Failed to load the challenge', @@ -404,6 +412,20 @@ function onFetchChallengeStatisticsDone(state, action) { }; } +/** + * Handles CHALLENGE/SET_COMMUNITY_ID action. + * @param {Object} state + * @param {Object} action + * @return {Object} New state. + */ +function onSetCommunityId(state, action) { + return { + ...state, + communityId: action.payload.communityId, + }; +} + + /** * Creates a new Challenge reducer with the specified initial state. * @param {Object} initialState Optional. Initial state. @@ -449,6 +471,7 @@ function create(initialState) { [a.getSubmissionInformationDone]: onGetSubmissionInformationDone, [a.fetchChallengeStatisticsInit]: state => state, [a.fetchChallengeStatisticsDone]: onFetchChallengeStatisticsDone, + [a.setCommunityId]: onSetCommunityId, }, _.defaults(initialState, { details: null, loadingCheckpoints: false, @@ -457,6 +480,7 @@ function create(initialState) { loadingMMSubmissionsForChallengeId: '', loadingSubmissionInformationForSubmissionId: '', mySubmissions: {}, + communityId: null, checkpoints: null, registering: false, results: null,