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 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 5d0825f6..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": "1.2.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/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..58209d32 100644 --- a/src/reducers/challenge.js +++ b/src/reducers/challenge.js @@ -53,11 +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', - 'This challenge is only available to those in a private group.' - + ' It looks like you do not have access to this challenge.', - ); + 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', @@ -403,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. @@ -448,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, @@ -456,6 +480,7 @@ function create(initialState) { loadingMMSubmissionsForChallengeId: '', loadingSubmissionInformationForSubmissionId: '', mySubmissions: {}, + communityId: null, checkpoints: null, registering: false, results: null, diff --git a/src/reducers/errors.js b/src/reducers/errors.js index e2b93070..153d105f 100644 --- a/src/reducers/errors.js +++ b/src/reducers/errors.js @@ -30,7 +30,8 @@ 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 }], + // eslint-disable-next-line max-len + 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)); }); } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy