From 58fd1acb824498090eda81dbc28f359a9788dc40 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Sat, 23 May 2020 15:00:38 -0300 Subject: [PATCH 001/144] Updated 'resources' call to use memberId --- src/actions/members.js | 8 ++++---- src/services/challenges.js | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/actions/members.js b/src/actions/members.js index 45b9606a..fa493670 100644 --- a/src/actions/members.js +++ b/src/actions/members.js @@ -283,7 +283,7 @@ async function getUserSRMInit(handle, uuid) { * @static * @desc Create an action that loads the member SRM. * @param {String} uuid Operation UUID. - * @param {String} handle Member handle. + * @param {Number} memberId Member ID. * @param {String} tokenV3 v3 auth token. * @param {Number} start page. * @param {Number} page size. @@ -291,7 +291,7 @@ async function getUserSRMInit(handle, uuid) { * @return {Action} */ async function getUserSRMDone( - uuid, handle, tokenV3, pageNum, pageSize, + uuid, memberId, tokenV3, pageNum, pageSize, refresh, ) { const filter = { @@ -306,11 +306,11 @@ async function getUserSRMDone( }; const service = getChallengesService(tokenV3); - return service.getUserSrms(handle, params).then(res => ({ + return service.getUserSrms(memberId, params).then(res => ({ uuid, srms: res, refresh, - handle, + memberId, })); } diff --git a/src/services/challenges.js b/src/services/challenges.js index a7cdaf3f..986879f0 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -430,12 +430,12 @@ class ChallengesService { /** * Gets SRM matches related to the user. - * @param {String} handle + * @param {Number} memberId * @param {Object} params * @return {Promise} */ - async getUserSrms(handle, params) { - const challenges = await this.private.apiV5.get(`/resources?memberHandle=${handle}`); + async getUserSrms(memberId, params) { + const challenges = await this.private.apiV5.get(`/resources/${memberId}/challenges`); let newParams = params; if (challenges) { const { challengeId } = challenges[0]; From 564fd25c272737902e8ac1dc2cf7314785b2832e Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Sat, 23 May 2020 16:20:43 -0300 Subject: [PATCH 002/144] getApiResponsePayload return null in case response is 200 but empty --- src/utils/tc.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/tc.js b/src/utils/tc.js index 4b27c0aa..aed187ca 100644 --- a/src/utils/tc.js +++ b/src/utils/tc.js @@ -41,6 +41,9 @@ export async function getApiResponsePayload(res, shouldThrowError = true) { } } const x = (await res.json()).result; + if (!x) { + return null; + } if ((!x.success)) { if (shouldThrowError) { throw new Error(x.content); From befdfdf295fa824268ab66986f5bd44a2886c9de Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Mon, 25 May 2020 15:42:43 -0300 Subject: [PATCH 003/144] Removed hardcoded challenge typeId Added getChallengeTypeId() to get challenge id by abbreviation --- src/services/challenges.js | 73 ++++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 19 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 986879f0..8644155f 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -340,6 +340,22 @@ class ChallengesService { )); } + /** + * Get the ID from a challenge type by abbreviation + * @param {String} abbreviation + * @return {Promise} ID from first abbreviation match + */ + async getChallengeTypeId(abbreviation) { + const ret = await this.private.apiV5.get(`/challenge-types?abbreviation=${abbreviation}`) + .then(checkErrorV5).then(res => res); + + if (_.isEmpty(ret.result)) { + throw new Error('Challenge typeId not found!'); + } + + return ret.result[0].id; + } + /** * Gets possible challenge tags (technologies). * @return {Promise} Resolves to the array of tag strings. @@ -375,7 +391,17 @@ class ChallengesService { * @return {Promise} */ async getSrms(params) { - const res = await this.private.apiV5.get(`/challenges/?${qs.stringify(params)}`); + const typeId = await this.getChallengeTypeId('DEVELOP_SINGLE_ROUND_MATCH'); + if (!typeId) { + return null; + } + + const newParams = { + ...params, + typeId, + }; + + const res = await this.private.apiV5.get(`/challenges?${qs.stringify(newParams)}`); return getApiResponsePayload(res); } @@ -415,17 +441,25 @@ class ChallengesService { /** * Gets marathon matches of the specified user. - * @param {String} userId User whose challenges we want to fetch. - * @param {Object} filters Optional. - * @param {Number} params Optional. + * @param {String} memberId User whose challenges we want to fetch. + * @param {Object} params * @return {Promise} Resolves to the api response. */ - async getUserMarathonMatches(userId) { - const marathonTypeId = 'c2579605-e294-4967-b3db-875ef85240cd'; - const url = `/challenges?typeId=${marathonTypeId}&memberId=${userId}`; + async getUserMarathonMatches(memberId, params) { + const typeId = await this.getChallengeTypeId('DEVELOP_MARATHON_MATCH'); + + if (!typeId) { + return null; + } - const res = await this.private.apiV5.get(url); - return res; + const newParams = { + ...params, + typeId, + memberId, + }; + + const res = await this.private.apiV5.get(`/challenges?${qs.stringify(newParams)}`); + return getApiResponsePayload(res); } /** @@ -435,18 +469,19 @@ class ChallengesService { * @return {Promise} */ async getUserSrms(memberId, params) { - const challenges = await this.private.apiV5.get(`/resources/${memberId}/challenges`); - let newParams = params; - if (challenges) { - const { challengeId } = challenges[0]; - newParams = { - ...params, - challengeId, - }; + const typeId = await this.getChallengeTypeId('DEVELOP_SINGLE_ROUND_MATCH'); + + if (!typeId) { + return null; } - const url = `/challenges/${qs.stringify(newParams)}`; - const res = await this.private.apiV5.get(url); + const newParams = { + ...params, + typeId, + memberId, + }; + + const res = await this.private.apiV5.get(`/challenges?${qs.stringify(newParams)}`); return getApiResponsePayload(res); } From f110201fe64d8e08c56ade87e2a181e508aa40bc Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Sat, 30 May 2020 10:48:06 +0530 Subject: [PATCH 004/144] fix for issue #4435 --- src/services/challenges.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index ea4f9adc..be43c5a5 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -319,10 +319,33 @@ class ChallengesService { * @return {Promise} Resolves to the challenge object. */ async getChallengeDetails(challengeId) { - const challengeFiltered = await this.private.getChallenges('/challenges/', { id: challengeId }) + let isLegacyChallenge = false; + const filters = {}; + // if (challengeId.length >= 5 && challengeId.length <= 8) { + // isLegacyChallenge = true; + // challengeDetails = await this.private + // .getChallenges('/challenges/', { legacyId: challengeId }) + // .then(res => res.challenges[0]); + // } else { + // challengeDetails = await this.private. + // getChallenges('/challenges/', { id: challengeId }) + // .then(res => res.challenges[0]); + // } + + // condition based on ROUTE used for Review Opportunities, change if needed + if (challengeId.length >= 5 && challengeId.length <= 8) { + isLegacyChallenge = true; + filters.legacyId = challengeId; + } else { + filters.id = challengeId; + } + const challengeDetails = await this.private.getChallenges('/challenges/', filters) .then(res => res.challenges[0]); - return challengeFiltered; + if (challengeDetails) { + challengeDetails.isLegacyChallenge = isLegacyChallenge; + } + return challengeDetails; } /** From d5868e7b500ff98df0964352989e41057e777e39 Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Sat, 30 May 2020 11:58:35 +0530 Subject: [PATCH 005/144] fix for issue #4430 --- src/services/challenges.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/services/challenges.js b/src/services/challenges.js index ea4f9adc..203c5b3c 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -322,6 +322,16 @@ class ChallengesService { const challengeFiltered = await this.private.getChallenges('/challenges/', { id: challengeId }) .then(res => res.challenges[0]); + if (challengeFiltered) { + const { events } = challengeFiltered.metadata; + if (events) { + challengeFiltered.events = _.map(events, e => ({ + eventName: e.key, + eventId: e.id, + description: e.name, + })); + } + } return challengeFiltered; } From 2906e842e62e14dfe9b3961d3380efc7c4cbb584 Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Sun, 31 May 2020 00:15:20 +0530 Subject: [PATCH 006/144] fix for issue #4435 --- src/services/challenges.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index be43c5a5..d2d6b2ae 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -321,17 +321,6 @@ class ChallengesService { async getChallengeDetails(challengeId) { let isLegacyChallenge = false; const filters = {}; - // if (challengeId.length >= 5 && challengeId.length <= 8) { - // isLegacyChallenge = true; - // challengeDetails = await this.private - // .getChallenges('/challenges/', { legacyId: challengeId }) - // .then(res => res.challenges[0]); - // } else { - // challengeDetails = await this.private. - // getChallenges('/challenges/', { id: challengeId }) - // .then(res => res.challenges[0]); - // } - // condition based on ROUTE used for Review Opportunities, change if needed if (challengeId.length >= 5 && challengeId.length <= 8) { isLegacyChallenge = true; From ede622f838ee4d701229fac3bff60bbdb6502e42 Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Sun, 31 May 2020 10:32:32 +0530 Subject: [PATCH 007/144] fix for issue #4435 --- src/reducers/challenge.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/reducers/challenge.js b/src/reducers/challenge.js index 26cee382..6db8365f 100644 --- a/src/reducers/challenge.js +++ b/src/reducers/challenge.js @@ -62,7 +62,15 @@ function onGetDetailsDone(state, action) { } const details = action.payload; - if (_.toString(details.id) !== state.loadingDetailsForChallengeId) { + + // condition based on ROUTE used for Review Opportunities, change if needed + const challengeId = state.loadingDetailsForChallengeId; + let compareChallenge = details.id; + if (challengeId.length >= 5 && challengeId.length <= 8) { + compareChallenge = details.legacyId; + } + + if (_.toString(compareChallenge) !== challengeId) { return state; } From be906cf64181a7e291593b4be00590d949ec6e53 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Mon, 1 Jun 2020 14:31:34 +0530 Subject: [PATCH 008/144] test release - bump ver to 1000.19.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a5453a16..f15f4452 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.19.3", + "version": "1000.19.4", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 2b8c31efdfa7add784a3d2e924280ef104f30377 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Tue, 2 Jun 2020 17:42:46 +0530 Subject: [PATCH 009/144] Npm ver bump up to 1000.19.5 for https://github.com/topcoder-platform/community-app/issues/4447 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f15f4452..71c15803 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.19.4", + "version": "1000.19.5", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From edd0eaf9683f3af28c26ae35055216a08fb7a835 Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Wed, 3 Jun 2020 06:19:37 +0530 Subject: [PATCH 010/144] fix tests --- .../actions/__snapshots__/challenge.js.snap | 4 +- __tests__/actions/challenge.js | 8 +- .../reducers/__snapshots__/challenge.js.snap | 100 +++++++++--------- __tests__/reducers/challenge.js | 16 +-- 4 files changed, 64 insertions(+), 64 deletions(-) diff --git a/__tests__/actions/__snapshots__/challenge.js.snap b/__tests__/actions/__snapshots__/challenge.js.snap index a996a82a..709efa4e 100644 --- a/__tests__/actions/__snapshots__/challenge.js.snap +++ b/__tests__/actions/__snapshots__/challenge.js.snap @@ -2,7 +2,7 @@ exports[`challenge.fetchChallengeInit 1`] = ` Object { - "payload": "12345", + "payload": "123456789", "type": "CHALLENGE/GET_DETAILS_INIT", } `; @@ -16,7 +16,7 @@ Object { exports[`challenge.fetchSubmissionsInit 1`] = ` Object { - "payload": "12345", + "payload": "123456789", "type": "CHALLENGE/GET_SUBMISSIONS_INIT", } `; diff --git a/__tests__/actions/challenge.js b/__tests__/actions/challenge.js index 2547692c..56ccc005 100644 --- a/__tests__/actions/challenge.js +++ b/__tests__/actions/challenge.js @@ -3,20 +3,20 @@ import { actions } from '../../src'; jest.mock('../../src/services/challenges'); test('challenge.fetchChallengeInit', () => { - expect(actions.challenge.getDetailsInit(12345)).toMatchSnapshot(); + expect(actions.challenge.getDetailsInit(123456789)).toMatchSnapshot(); }); test('challenge.fetchSubmissionsInit', () => { - expect(actions.challenge.getSubmissionsInit(12345)).toMatchSnapshot(); + expect(actions.challenge.getSubmissionsInit(123456789)).toMatchSnapshot(); }); test('challenge.getDetailsDone', () => { - expect(actions.challenge.getDetailsDone(12345)).toMatchSnapshot(); + expect(actions.challenge.getDetailsDone(123456789)).toMatchSnapshot(); }); test('challenge.fetchSubmissionsDone', () => { - expect(actions.challenge.getSubmissionsDone(12345, {})).toMatchSnapshot(); + expect(actions.challenge.getSubmissionsDone(123456789, {})).toMatchSnapshot(); }); test('challenge.getActiveChallengesCountInit', () => { diff --git a/__tests__/reducers/__snapshots__/challenge.js.snap b/__tests__/reducers/__snapshots__/challenge.js.snap index be090f1d..009e5691 100644 --- a/__tests__/reducers/__snapshots__/challenge.js.snap +++ b/__tests__/reducers/__snapshots__/challenge.js.snap @@ -25,7 +25,7 @@ exports[`Default reducer Handles CHALLENGE/GET_DETAILS_DONE as expected 1`] = ` Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": false, @@ -50,7 +50,7 @@ exports[`Default reducer Handles CHALLENGE/GET_DETAILS_DONE with error as expect Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -77,7 +77,7 @@ Object { "details": null, "fetchChallengeFailure": false, "loadingCheckpoints": false, - "loadingDetailsForChallengeId": "12345", + "loadingDetailsForChallengeId": "123456789", "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionInformationForSubmissionId": "", @@ -97,7 +97,7 @@ exports[`Default reducer Handles deleteSubmissionDone as expected 1`] = ` Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -109,7 +109,7 @@ Object { "loadingSubmissionsForChallengeId": "", "mmSubmissions": Array [], "mySubmissions": Object { - "challengeId": "12345", + "challengeId": "123456789", "v2": Array [], }, "mySubmissionsManagement": Object { @@ -128,7 +128,7 @@ exports[`Default reducer Handles fetchSubmissionsDone as expected 1`] = ` Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -140,7 +140,7 @@ Object { "loadingSubmissionsForChallengeId": "", "mmSubmissions": Array [], "mySubmissions": Object { - "challengeId": "12345", + "challengeId": "123456789", "v2": Array [ Object { "submissionId": "1", @@ -161,7 +161,7 @@ exports[`Default reducer Handles fetchSubmissionsDoneError as expected 1`] = ` Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -192,7 +192,7 @@ exports[`Default reducer Handles fetchSubmissionsInit as expected 1`] = ` Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -201,7 +201,7 @@ Object { "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionInformationForSubmissionId": "", - "loadingSubmissionsForChallengeId": "12345", + "loadingSubmissionsForChallengeId": "123456789", "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", @@ -222,7 +222,7 @@ Object { "activeChallengesCount": 5, "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -253,7 +253,7 @@ exports[`Factory with server-side rendering Creates expected intial state 1`] = Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": false, @@ -265,7 +265,7 @@ Object { "loadingSubmissionsForChallengeId": "", "mmSubmissions": Array [], "mySubmissions": Object { - "challengeId": "12345", + "challengeId": "123456789", "v2": Array [ Object { "submissionId": "1", @@ -286,7 +286,7 @@ exports[`Factory with server-side rendering Handles CHALLENGE/GET_DETAILS_DONE a Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": false, @@ -298,7 +298,7 @@ Object { "loadingSubmissionsForChallengeId": "", "mmSubmissions": Array [], "mySubmissions": Object { - "challengeId": "12345", + "challengeId": "123456789", "v2": Array [ Object { "submissionId": "1", @@ -319,7 +319,7 @@ exports[`Factory with server-side rendering Handles CHALLENGE/GET_DETAILS_DONE w Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -331,7 +331,7 @@ Object { "loadingSubmissionsForChallengeId": "", "mmSubmissions": Array [], "mySubmissions": Object { - "challengeId": "12345", + "challengeId": "123456789", "v2": Array [ Object { "submissionId": "1", @@ -352,19 +352,19 @@ exports[`Factory with server-side rendering Handles CHALLENGE/GET_DETAILS_INIT a Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": false, "loadingCheckpoints": false, - "loadingDetailsForChallengeId": "12345", + "loadingDetailsForChallengeId": "123456789", "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionInformationForSubmissionId": "", "loadingSubmissionsForChallengeId": "", "mmSubmissions": Array [], "mySubmissions": Object { - "challengeId": "12345", + "challengeId": "123456789", "v2": Array [ Object { "submissionId": "1", @@ -385,7 +385,7 @@ exports[`Factory with server-side rendering Handles deleteSubmissionDone as expe Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -397,7 +397,7 @@ Object { "loadingSubmissionsForChallengeId": "", "mmSubmissions": Array [], "mySubmissions": Object { - "challengeId": "12345", + "challengeId": "123456789", "v2": Array [], }, "mySubmissionsManagement": Object { @@ -416,7 +416,7 @@ exports[`Factory with server-side rendering Handles fetchSubmissionsDone as expe Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -428,7 +428,7 @@ Object { "loadingSubmissionsForChallengeId": "", "mmSubmissions": Array [], "mySubmissions": Object { - "challengeId": "12345", + "challengeId": "123456789", "v2": Array [ Object { "submissionId": "1", @@ -449,7 +449,7 @@ exports[`Factory with server-side rendering Handles fetchSubmissionsDoneError as Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -480,7 +480,7 @@ exports[`Factory with server-side rendering Handles fetchSubmissionsInit as expe Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -489,7 +489,7 @@ Object { "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionInformationForSubmissionId": "", - "loadingSubmissionsForChallengeId": "12345", + "loadingSubmissionsForChallengeId": "123456789", "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", @@ -510,7 +510,7 @@ Object { "activeChallengesCount": 5, "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -562,7 +562,7 @@ exports[`Factory without http request Handles CHALLENGE/GET_DETAILS_DONE as expe Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": false, @@ -587,7 +587,7 @@ exports[`Factory without http request Handles CHALLENGE/GET_DETAILS_DONE with er Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -614,7 +614,7 @@ Object { "details": null, "fetchChallengeFailure": false, "loadingCheckpoints": false, - "loadingDetailsForChallengeId": "12345", + "loadingDetailsForChallengeId": "123456789", "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionInformationForSubmissionId": "", @@ -634,7 +634,7 @@ exports[`Factory without http request Handles deleteSubmissionDone as expected 1 Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -646,7 +646,7 @@ Object { "loadingSubmissionsForChallengeId": "", "mmSubmissions": Array [], "mySubmissions": Object { - "challengeId": "12345", + "challengeId": "123456789", "v2": Array [], }, "mySubmissionsManagement": Object { @@ -665,7 +665,7 @@ exports[`Factory without http request Handles fetchSubmissionsDone as expected 1 Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -677,7 +677,7 @@ Object { "loadingSubmissionsForChallengeId": "", "mmSubmissions": Array [], "mySubmissions": Object { - "challengeId": "12345", + "challengeId": "123456789", "v2": Array [ Object { "submissionId": "1", @@ -698,7 +698,7 @@ exports[`Factory without http request Handles fetchSubmissionsDoneError as expec Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -729,7 +729,7 @@ exports[`Factory without http request Handles fetchSubmissionsInit as expected 1 Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -738,7 +738,7 @@ Object { "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionInformationForSubmissionId": "", - "loadingSubmissionsForChallengeId": "12345", + "loadingSubmissionsForChallengeId": "123456789", "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", @@ -759,7 +759,7 @@ Object { "activeChallengesCount": 5, "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -811,7 +811,7 @@ exports[`Factory without server-side rendering Handles CHALLENGE/GET_DETAILS_DON Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": false, @@ -836,7 +836,7 @@ exports[`Factory without server-side rendering Handles CHALLENGE/GET_DETAILS_DON Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -863,7 +863,7 @@ Object { "details": null, "fetchChallengeFailure": false, "loadingCheckpoints": false, - "loadingDetailsForChallengeId": "12345", + "loadingDetailsForChallengeId": "123456789", "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionInformationForSubmissionId": "", @@ -883,7 +883,7 @@ exports[`Factory without server-side rendering Handles deleteSubmissionDone as e Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -895,7 +895,7 @@ Object { "loadingSubmissionsForChallengeId": "", "mmSubmissions": Array [], "mySubmissions": Object { - "challengeId": "12345", + "challengeId": "123456789", "v2": Array [], }, "mySubmissionsManagement": Object { @@ -914,7 +914,7 @@ exports[`Factory without server-side rendering Handles fetchSubmissionsDone as e Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -926,7 +926,7 @@ Object { "loadingSubmissionsForChallengeId": "", "mmSubmissions": Array [], "mySubmissions": Object { - "challengeId": "12345", + "challengeId": "123456789", "v2": Array [ Object { "submissionId": "1", @@ -947,7 +947,7 @@ exports[`Factory without server-side rendering Handles fetchSubmissionsDoneError Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -978,7 +978,7 @@ exports[`Factory without server-side rendering Handles fetchSubmissionsInit as e Object { "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", @@ -987,7 +987,7 @@ Object { "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionInformationForSubmissionId": "", - "loadingSubmissionsForChallengeId": "12345", + "loadingSubmissionsForChallengeId": "123456789", "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", @@ -1008,7 +1008,7 @@ Object { "activeChallengesCount": 5, "checkpoints": null, "details": Object { - "id": 12345, + "id": 123456789, "tag": "v3-normalized-details", }, "fetchChallengeFailure": "Unknown error", diff --git a/__tests__/reducers/challenge.js b/__tests__/reducers/challenge.js index 5177aaff..b35324c1 100644 --- a/__tests__/reducers/challenge.js +++ b/__tests__/reducers/challenge.js @@ -5,24 +5,24 @@ import { actions } from '../../src'; const mockChallengeActions = { challenge: { - getDetailsInit: mockAction('CHALLENGE/GET_DETAILS_INIT', '12345'), + getDetailsInit: mockAction('CHALLENGE/GET_DETAILS_INIT', '123456789'), getDetailsDone: mockAction('CHALLENGE/GET_DETAILS_DONE', Promise.resolve({ - id: 12345, + id: 123456789, tag: 'v3-normalized-details', })), getDetailsDoneError: mockAction( 'CHALLENGE/GET_DETAILS_DONE', - { challengeId: '12345' }, + { challengeId: '123456789' }, 'Unknown error', ), - getSubmissionsInit: mockAction('CHALLENGE/GET_SUBMISSIONS_INIT', '12345'), + getSubmissionsInit: mockAction('CHALLENGE/GET_SUBMISSIONS_INIT', '123456789'), getSubmissionsDone: mockAction( 'CHALLENGE/GET_SUBMISSIONS_DONE', - Promise.resolve({ challengeId: '12345', submissions: [{ submissionId: '1' }] }), + Promise.resolve({ challengeId: '123456789', submissions: [{ submissionId: '1' }] }), ), getSubmissionsDoneError: mockAction( 'CHALLENGE/GET_SUBMISSIONS_DONE', - { challengeId: '12345' }, + { challengeId: '123456789' }, 'Unknown error', ), getActiveChallengesCountDone: mockAction('CHALLENGE/GET_ACTIVE_CHALLENGES_COUNT_DONE', 5), @@ -64,7 +64,7 @@ function testReducer() { }); test('Handles CHALLENGE/GET_DETAILS_INIT as expected', () => { - state = reducer(state, mockChallengeActions.challenge.getDetailsInit(12345)); + state = reducer(state, mockChallengeActions.challenge.getDetailsInit(123456789)); expect(state).toMatchSnapshot(); }); @@ -139,7 +139,7 @@ describe('Factory with server-side rendering', () => { }, challenge: { challengeDetails: { - id: '12345', + id: '123456789', mySubmission: true, }, }, From aeb69b56418b6d1926a8489202275afefade516b Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Wed, 3 Jun 2020 03:15:28 -0300 Subject: [PATCH 011/144] Get SRMs via V4 API for now --- src/actions/members.js | 8 ++++---- src/services/challenges.js | 32 +++++--------------------------- 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/actions/members.js b/src/actions/members.js index fa493670..45b9606a 100644 --- a/src/actions/members.js +++ b/src/actions/members.js @@ -283,7 +283,7 @@ async function getUserSRMInit(handle, uuid) { * @static * @desc Create an action that loads the member SRM. * @param {String} uuid Operation UUID. - * @param {Number} memberId Member ID. + * @param {String} handle Member handle. * @param {String} tokenV3 v3 auth token. * @param {Number} start page. * @param {Number} page size. @@ -291,7 +291,7 @@ async function getUserSRMInit(handle, uuid) { * @return {Action} */ async function getUserSRMDone( - uuid, memberId, tokenV3, pageNum, pageSize, + uuid, handle, tokenV3, pageNum, pageSize, refresh, ) { const filter = { @@ -306,11 +306,11 @@ async function getUserSRMDone( }; const service = getChallengesService(tokenV3); - return service.getUserSrms(memberId, params).then(res => ({ + return service.getUserSrms(handle, params).then(res => ({ uuid, srms: res, refresh, - memberId, + handle, })); } diff --git a/src/services/challenges.js b/src/services/challenges.js index 8644155f..c1f0acc0 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -387,21 +387,10 @@ class ChallengesService { /** * Gets SRM matches. * @param {Object} params - * @param {string} typeId Challenge SRM TypeId * @return {Promise} */ async getSrms(params) { - const typeId = await this.getChallengeTypeId('DEVELOP_SINGLE_ROUND_MATCH'); - if (!typeId) { - return null; - } - - const newParams = { - ...params, - typeId, - }; - - const res = await this.private.apiV5.get(`/challenges?${qs.stringify(newParams)}`); + const res = await this.private.api.get(`/srms/?${qs.stringify(params)}`); return getApiResponsePayload(res); } @@ -464,24 +453,13 @@ class ChallengesService { /** * Gets SRM matches related to the user. - * @param {Number} memberId + * @param {String} handle * @param {Object} params * @return {Promise} */ - async getUserSrms(memberId, params) { - const typeId = await this.getChallengeTypeId('DEVELOP_SINGLE_ROUND_MATCH'); - - if (!typeId) { - return null; - } - - const newParams = { - ...params, - typeId, - memberId, - }; - - const res = await this.private.apiV5.get(`/challenges?${qs.stringify(newParams)}`); + async getUserSrms(handle, params) { + const url = `/members/${handle}/srms/?${qs.stringify(params)}`; + const res = await this.private.api.get(url); return getApiResponsePayload(res); } From ac74ffb4432a242b634b098be4ec868f754607c0 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Wed, 3 Jun 2020 16:54:31 +0530 Subject: [PATCH 012/144] Npm ver update to 1000.19.6 For https://github.com/topcoder-platform/community-app/issues/4378 https://github.com/topcoder-platform/community-app/pull/4415 https://github.com/topcoder-platform/topcoder-react-lib/pull/169 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 71c15803..feb2909c 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.19.5", + "version": "1000.19.6", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 0cc86351212774dc5466aa24b6174871781e74d8 Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Fri, 5 Jun 2020 03:13:16 +0530 Subject: [PATCH 013/144] #4430 - rework needed due to backend changes --- src/services/challenges.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 0bdcb3cd..5b40bab3 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -333,14 +333,11 @@ class ChallengesService { if (challengeFiltered) { challengeFiltered.isLegacyChallenge = isLegacyChallenge; - const { events } = challengeFiltered.metadata; - if (events) { - challengeFiltered.events = _.map(events, e => ({ - eventName: e.key, - eventId: e.id, - description: e.name, - })); - } + challengeFiltered.events = _.map(challengeFiltered.events, e => ({ + eventName: e.key, + eventId: e.id, + description: e.name, + })); } return challengeFiltered; } From b34816f3759348c5c42cadf51c854c27748f8c9a Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Fri, 5 Jun 2020 18:21:30 +0530 Subject: [PATCH 014/144] npm bump up "version": "1000.19.7", https://github.com/topcoder-platform/community-app/issues/4430 https://github.com/topcoder-platform/community-app/pull/4443 https://github.com/topcoder-platform/topcoder-react-lib/pull/176 https://github.com/topcoder-platform/topcoder-react-lib/pull/180 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index feb2909c..6adddbc0 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.19.6", + "version": "1000.19.7", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 1aaf110c8989ead4241faaca327abb3808ed7508 Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Sat, 6 Jun 2020 15:14:14 +0530 Subject: [PATCH 015/144] fix for issue #4384 --- src/services/challenges.js | 48 ++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 0bdcb3cd..20f37933 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -146,12 +146,19 @@ class ChallengesService { }; const url = `${endpoint}?${qs.stringify(query)}`; const res = await this.private.apiV5.get(url).then(checkErrorV5); + + const memberId = decodeToken(this.private.tokenV3).userId; + let myChallenges = {}; + if (memberId) { // if token then check myChallenges count + myChallenges = await this.private.apiV5.get(`/resources/${memberId}/challenges`).then(checkErrorV5); + } + return { challenges: res.result || [], totalCount: res.headers.get('x-total'), meta: { allChallengesCount: res.headers.get('x-total'), - myChallengesCount: 0, + myChallengesCount: (myChallenges.result && myChallenges.result.length) || 0, ongoingChallengesCount: 0, openChallengesCount: 0, totalCount: res.headers.get('x-total'), @@ -406,10 +413,17 @@ class ChallengesService { * @param {Object} params Optional. * @return {Promise} Resolves to the api response. */ - getChallenges(filters, params) { + async getChallenges(filters, params) { + const memberId = this.private.tokenV3 ? decodeToken(this.private.tokenV3).userId : null; + let userChallenges = []; + if (memberId) { + userChallenges = await this.private.apiV5.get(`/resources/${memberId}/challenges`) + .then(checkErrorV5).then(res => res.result); + } return this.private.getChallenges('/challenges/', filters, params) .then((res) => { - res.challenges.forEach(item => normalizeChallenge(item)); + res.challenges.forEach(item => normalizeChallenge(item, + userChallenges.includes(item.id) ? memberId : null)); return res; }); } @@ -440,21 +454,19 @@ class ChallengesService { * @param {Number} params Optional. * @return {Promise} Resolves to the api response. */ - getUserChallenges(userId, filters, params) { - const userFilters = _.cloneDeep(filters); - ChallengesService.updateFiltersParamsForGettingMemberChallenges(userFilters, params); - const query = { - ...params, - ...userFilters, - memberId: userId, - }; - const endpoint = '/challenges'; - const url = `${endpoint}?${qs.stringify(_.omit(query, ['limit', 'offset', 'technologies']))}`; - - return this.private.apiV5.get(url) - .then((res) => { - res.challenges.forEach(item => normalizeChallenge(item, userId)); - return res; + getUserChallenges(userId) { + return this.private.apiV5.get(`/resources/${userId}/challenges`) + .then(checkErrorV5).then((userChallenges) => { + const param = { ids: userChallenges.result }; + const endpoint = `/challenges?${qs.stringify(param)}`; + return this.private.apiV5.get(endpoint) + .then(checkErrorV5).then((res) => { + res.result.forEach(item => normalizeChallenge(item, userId)); + const newResponse = {}; + newResponse.challenges = res.result; + newResponse.totalCount = res.result.length; + return newResponse; + }); }); } From 011284b67f18674d6d07d4619a884188225f0ec4 Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Sun, 7 Jun 2020 09:56:04 +0530 Subject: [PATCH 016/144] fix for issue #4384 --- src/services/challenges.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 20f37933..d34b3b5a 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -146,19 +146,12 @@ class ChallengesService { }; const url = `${endpoint}?${qs.stringify(query)}`; const res = await this.private.apiV5.get(url).then(checkErrorV5); - - const memberId = decodeToken(this.private.tokenV3).userId; - let myChallenges = {}; - if (memberId) { // if token then check myChallenges count - myChallenges = await this.private.apiV5.get(`/resources/${memberId}/challenges`).then(checkErrorV5); - } - return { challenges: res.result || [], totalCount: res.headers.get('x-total'), meta: { allChallengesCount: res.headers.get('x-total'), - myChallengesCount: (myChallenges.result && myChallenges.result.length) || 0, + myChallengesCount: 0, ongoingChallengesCount: 0, openChallengesCount: 0, totalCount: res.headers.get('x-total'), @@ -450,16 +443,22 @@ class ChallengesService { /** * Gets challenges of the specified user. * @param {String} userId User id whose challenges we want to fetch. - * @param {Object} filters Optional. - * @param {Number} params Optional. * @return {Promise} Resolves to the api response. */ - getUserChallenges(userId) { + getUserChallenges(userId, filters, params) { + const userFilters = _.cloneDeep(filters); + ChallengesService.updateFiltersParamsForGettingMemberChallenges(userFilters, params); return this.private.apiV5.get(`/resources/${userId}/challenges`) .then(checkErrorV5).then((userChallenges) => { - const param = { ids: userChallenges.result }; - const endpoint = `/challenges?${qs.stringify(param)}`; - return this.private.apiV5.get(endpoint) + const query = { + ...params, + ...userFilters, + ids: userChallenges.result, + }; + const endpoint = '/challenges'; + const url = `${endpoint}?${qs.stringify(_.omit(query, ['limit', 'offset', 'technologies']))}`; + + return this.private.apiV5.get(url) .then(checkErrorV5).then((res) => { res.result.forEach(item => normalizeChallenge(item, userId)); const newResponse = {}; From 0c3b90e619dbe17cbe01c70b4477c0312b8ea890 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Sun, 7 Jun 2020 10:31:49 +0530 Subject: [PATCH 017/144] npm bump version 1000.19.8 https://github.com/topcoder-platform/community-app/issues/4384 simran https://github.com/topcoder-platform/community-app/pull/4481 https://github.com/topcoder-platform/topcoder-react-lib/pull/181 1000.19.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6adddbc0..9a1a275f 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.19.7", + "version": "1000.19.8", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From ec5dc90ff44c72a9cea315d247e27b49af41f68b Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Sun, 7 Jun 2020 14:45:53 +0530 Subject: [PATCH 018/144] fix for issue #4375 & #4376 --- src/services/challenges.js | 8 +++++++- src/utils/challenge/filter.js | 5 +---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index d185322f..4d287564 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -146,12 +146,18 @@ class ChallengesService { }; const url = `${endpoint}?${qs.stringify(query)}`; const res = await this.private.apiV5.get(url).then(checkErrorV5); + let myChallengesCount = 0; + if (typeof this.private.tokenV3 !== 'undefined') { + const { userId } = decodeToken(this.private.tokenV3); + myChallengesCount = await this.private.apiV5.get(`/resources/${userId}/challenges`) + .then(checkErrorV5).then(userChallenges => userChallenges.headers.get('x-total')); + } return { challenges: res.result || [], totalCount: res.headers.get('x-total'), meta: { allChallengesCount: res.headers.get('x-total'), - myChallengesCount: 0, + myChallengesCount, ongoingChallengesCount: 0, openChallengesCount: 0, totalCount: res.headers.get('x-total'), diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 121ec1a7..fcaf1924 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -127,10 +127,7 @@ function filterByEndDate(challenge, state) { function filterByStarted(challenge, state) { if (_.isUndefined(state.started)) return true; - if (!challenge.phases) { - return true; - } - return _.some(challenge.phases, { isOpen: true, name: 'Registration' }); + return moment(challenge.registrationStartDate).isBefore(Date.now()); } function filterByStatus(challenge, state) { From 8449cba5e2a618838c79bb7ce34e1943f6ab6aeb Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Mon, 8 Jun 2020 08:17:45 +0530 Subject: [PATCH 019/144] npm bump up to 1000.19.9 https://github.com/topcoder-platform/community-app/issues/4376 simaran https://github.com/topcoder-platform/community-app/pull/4486 https://github.com/topcoder-platform/topcoder-react-lib/pull/182 1000.19.9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9a1a275f..9f694506 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.19.8", + "version": "1000.19.9", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 186cd458e0de40c14e03e8ebe81643c74d9d8df5 Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Mon, 8 Jun 2020 13:19:59 +0530 Subject: [PATCH 020/144] fix for issue #4384 feedback --- src/services/challenges.js | 54 +++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 4d287564..10f0ded0 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -146,18 +146,18 @@ class ChallengesService { }; const url = `${endpoint}?${qs.stringify(query)}`; const res = await this.private.apiV5.get(url).then(checkErrorV5); - let myChallengesCount = 0; + let myChallenges; if (typeof this.private.tokenV3 !== 'undefined') { const { userId } = decodeToken(this.private.tokenV3); - myChallengesCount = await this.private.apiV5.get(`/resources/${userId}/challenges`) - .then(checkErrorV5).then(userChallenges => userChallenges.headers.get('x-total')); + myChallenges = await this.private.apiV5.get(`/resources/${userId}/challenges`) + .then(checkErrorV5).then(userChallenges => userChallenges); } return { challenges: res.result || [], totalCount: res.headers.get('x-total'), meta: { allChallengesCount: res.headers.get('x-total'), - myChallengesCount, + myChallengesCount: (myChallenges && myChallenges.headers.get('x-total')) || 0, ongoingChallengesCount: 0, openChallengesCount: 0, totalCount: res.headers.get('x-total'), @@ -448,28 +448,34 @@ class ChallengesService { * @param {String} userId User id whose challenges we want to fetch. * @return {Promise} Resolves to the api response. */ - getUserChallenges(userId, filters, params) { + async getUserChallenges(userId, filters, params) { const userFilters = _.cloneDeep(filters); ChallengesService.updateFiltersParamsForGettingMemberChallenges(userFilters, params); - return this.private.apiV5.get(`/resources/${userId}/challenges`) - .then(checkErrorV5).then((userChallenges) => { - const query = { - ...params, - ...userFilters, - ids: userChallenges.result, - }; - const endpoint = '/challenges'; - const url = `${endpoint}?${qs.stringify(_.omit(query, ['limit', 'offset', 'technologies']))}`; - - return this.private.apiV5.get(url) - .then(checkErrorV5).then((res) => { - res.result.forEach(item => normalizeChallenge(item, userId)); - const newResponse = {}; - newResponse.challenges = res.result; - newResponse.totalCount = res.result.length; - return newResponse; - }); - }); + + const userChallenges = await this.private.apiV5.get(`/resources/${userId}/challenges`) + .then(checkErrorV5).then(res => res); + + let chResponse = null; + if (userChallenges.result && userChallenges.result.length > 0) { + const query = { + ...params, + ...userFilters, + ids: userChallenges.result, + }; + const endpoint = '/challenges'; + const url = `${endpoint}?${qs.stringify(_.omit(query, ['limit', 'offset', 'technologies']))}`; + chResponse = await this.private.apiV5.get(url) + .then(checkErrorV5).then((res) => { + res.result.forEach(item => normalizeChallenge(item, userId)); + return res; + }); + } + + const chResult = (chResponse && chResponse.result) || []; + return { + challenges: chResult, + totalCount: chResult.length, + }; } /** From 63d7e1e1960f287436c593ed19062dd74cf207a9 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Mon, 8 Jun 2020 13:45:23 +0530 Subject: [PATCH 021/144] npm bump 1000.19.10 https://github.com/topcoder-platform/community-app/issues/4384 simran https://github.com/topcoder-platform/community-app/pull/4481 https://github.com/topcoder-platform/topcoder-react-lib/pull/181 "https://github.com/topcoder-platform/community-app/pull/4483 https://github.com/topcoder-platform/community-app/pull/4484" https://github.com/topcoder-platform/topcoder-react-lib/pull/183 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9f694506..546c9ca2 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.19.9", + "version": "1000.19.10", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 8f1cadc5d95f1647c5e7bbdfc152b9547e945de9 Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Wed, 10 Jun 2020 01:42:40 +0530 Subject: [PATCH 022/144] fix for issue #4383 --- src/actions/members.js | 3 ++- src/services/challenges.js | 35 ++++++++++++++--------------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/actions/members.js b/src/actions/members.js index 45b9606a..acee1ce9 100644 --- a/src/actions/members.js +++ b/src/actions/members.js @@ -146,6 +146,7 @@ async function getActiveChallengesInit(handle, uuid) { async function getActiveChallengesDone(handle, uuid, tokenV3) { const filter = { status: 'Active' }; const service = getChallengesService(tokenV3); + const memberInfo = await getService(tokenV3).getMemberInfo(handle); /* TODO: Reuse `getAll` from `actions/challenge-listing` /* after it moved from `community-app` to here. */ @@ -160,7 +161,7 @@ async function getActiveChallengesDone(handle, uuid, tokenV3) { }); } const calls = [ - getAll(params => service.getUserChallenges(handle, filter, params)), + getAll(params => service.getUserChallenges(memberInfo.userId, filter, params)), ]; const [challenges] = await Promise.all(calls); diff --git a/src/services/challenges.js b/src/services/challenges.js index 10f0ded0..85daaf14 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -452,29 +452,22 @@ class ChallengesService { const userFilters = _.cloneDeep(filters); ChallengesService.updateFiltersParamsForGettingMemberChallenges(userFilters, params); - const userChallenges = await this.private.apiV5.get(`/resources/${userId}/challenges`) - .then(checkErrorV5).then(res => res); - - let chResponse = null; - if (userChallenges.result && userChallenges.result.length > 0) { - const query = { - ...params, - ...userFilters, - ids: userChallenges.result, - }; - const endpoint = '/challenges'; - const url = `${endpoint}?${qs.stringify(_.omit(query, ['limit', 'offset', 'technologies']))}`; - chResponse = await this.private.apiV5.get(url) - .then(checkErrorV5).then((res) => { - res.result.forEach(item => normalizeChallenge(item, userId)); - return res; - }); - } + const query = { + ...params, + ...userFilters, + memberId: userId, + }; + const url = `/challenges?${qs.stringify(_.omit(query, ['limit', 'offset', 'technologies']))}`; + const userChallenges = await this.private.apiV5.get(url) + .then(checkErrorV5) + .then((res) => { + res.result.forEach(item => normalizeChallenge(item, userId)); + return res.result; + }); - const chResult = (chResponse && chResponse.result) || []; return { - challenges: chResult, - totalCount: chResult.length, + challenges: userChallenges, + totalCount: userChallenges.length, }; } From c19bc09ba7f87359a672692339fc3a530d0f506a Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Wed, 10 Jun 2020 04:45:33 -0300 Subject: [PATCH 023/144] Added proxyApi --- src/services/api.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/services/api.js b/src/services/api.js index 4530a4a3..fffbc7c9 100644 --- a/src/services/api.js +++ b/src/services/api.js @@ -290,3 +290,21 @@ export async function getTcM2mToken() { const token = await m2m.getMachineToken(TC_M2M.CLIENT_ID, TC_M2M.CLIENT_SECRET); return token; } + +/** + * Call API via proxy + * + * @param {String} url to API endpoint + */ +export async function proxyApi(endpoint) { + let domain = ''; + if (isomorphy.isServerSide()) { + domain = `http://${config.ENV.HOST || 'localhost'}:${config.ENV.PORT || 3000}`; + } + const url = `${domain}/community-app-assets/api${endpoint}`; + let res = await fetch(url); + if (!res.ok) throw new Error(res.statusText); + res = (await res.json()); + if (res.message) throw new Error(res.message); + return res; +} From d25ed67276d1ab198eb90d5a534fe76d2dad88f1 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Wed, 10 Jun 2020 04:48:03 -0300 Subject: [PATCH 024/144] Updated getChallengeDetails to get registrants Updated getChallengeRegistrants to use proxyAPi --- src/services/challenges.js | 43 +++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 10f0ded0..8a0a3728 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -11,7 +11,7 @@ import { decodeToken } from 'tc-accounts'; import logger from '../utils/logger'; import { setErrorIcon, ERROR_ICON_TYPES } from '../utils/errors'; import { COMPETITION_TRACKS, getApiResponsePayload } from '../utils/tc'; -import { getApi } from './api'; +import { getApi, proxyApi } from './api'; import { getService as getMembersService } from './members'; export const ORDER_BY = { @@ -200,6 +200,7 @@ class ChallengesService { apiV3: getApi('V3', tokenV3), getChallenges, getMemberChallenges, + proxyApi, tokenV2, tokenV3, memberService: getMembersService(), @@ -325,27 +326,32 @@ class ChallengesService { * @return {Promise} Resolves to the challenge object. */ async getChallengeDetails(challengeId) { + let challenge = {}; let isLegacyChallenge = false; - const filters = {}; // condition based on ROUTE used for Review Opportunities, change if needed - if (challengeId.length >= 5 && challengeId.length <= 8) { + if (/^[\d]{5,8}$/.test(challengeId)) { isLegacyChallenge = true; - filters.legacyId = challengeId; + challenge = await this.private.getChallenges('/challenges/', { legacyId: challengeId }) + .then(res => res.challenges[0]); } else { - filters.id = challengeId; + challenge = await this.private.getChallenges(`/challenges/${challengeId}`) + .then(res => res.challenges); } - const challengeFiltered = await this.private.getChallenges('/challenges/', filters) - .then(res => res.challenges[0]); - - if (challengeFiltered) { - challengeFiltered.isLegacyChallenge = isLegacyChallenge; - challengeFiltered.events = _.map(challengeFiltered.events, e => ({ - eventName: e.key, - eventId: e.id, - description: e.name, - })); - } - return challengeFiltered; + + const registrants = await this.getChallengeRegistrants(challenge.id); + challenge.registrants = registrants; + + challenge.isLegacyChallenge = isLegacyChallenge; + + challenge.events = _.map(challenge.events, e => ({ + eventName: e.key, + eventId: e.id, + description: e.name, + })); + + challenge.fetchedWithAuth = Boolean(this.private.apiV5.private.token); + + return challenge; } /** @@ -354,8 +360,7 @@ class ChallengesService { * @return {Promise} Resolves to the challenge registrants array. */ async getChallengeRegistrants(challengeId) { - const registrants = await this.private.apiV5.get(`/resources/challengeId=${challengeId}`) - .then(checkError).then(res => res); + const registrants = await this.private.proxyApi(`/challenges/${challengeId}/registrants`); return registrants || []; } From 55352893ced499d6a43b7f328bd116c76c22af3e Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Wed, 10 Jun 2020 04:48:46 -0300 Subject: [PATCH 025/144] Update getRoleId to use proxyApi --- src/services/challenges.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 8a0a3728..78d98d2e 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -523,19 +523,17 @@ class ChallengesService { * @param {String} roleName * @return {Promise} */ - async getResourceRoleId(roleName) { + async getRoleId(roleName) { const params = { name: roleName, - isActive: true, }; - const roles = await this.private.apiV5.get(`/resource-roles?${qs.stringify(params)}`) - .then(checkErrorV5).then(res => res); + const roles = await this.private.proxyApi(`/challenges/roleId?${qs.stringify(params)}`); - if (_.isEmpty(roles.result)) { + if (_.isEmpty(roles)) { throw new Error('Resource Role not found!'); } - return roles.result[0].id; + return roles[0].id; } /** @@ -545,7 +543,7 @@ class ChallengesService { */ async register(challengeId) { const user = decodeToken(this.private.tokenV3); - const roleId = await this.getResourceRoleId('Submitter'); + const roleId = await this.getRoleId('Submitter'); const params = { challengeId, memberHandle: user.handle, @@ -563,7 +561,7 @@ class ChallengesService { */ async unregister(challengeId) { const user = decodeToken(this.private.tokenV3); - const roleId = await this.getResourceRoleId('Submitter'); + const roleId = await this.getRoleId('Submitter'); const params = { challengeId, memberHandle: user.handle, From cc436141c81494a478068daf99088054060e0054 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Wed, 10 Jun 2020 04:49:15 -0300 Subject: [PATCH 026/144] Fix challenge unregister() --- src/services/challenges.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 78d98d2e..f16a8a33 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -567,7 +567,7 @@ class ChallengesService { memberHandle: user.handle, roleId, }; - const res = await this.private.apiV5.delete('/resources', params); + const res = await this.private.apiV5.delete('/resources', JSON.stringify(params)); if (!res.ok) throw new Error(res.statusText); return res.json(); } From e26398ecdc6b42a21e2681c524afafac5ff36395 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Wed, 10 Jun 2020 04:49:23 -0300 Subject: [PATCH 027/144] Updated tests --- __tests__/__snapshots__/index.js.snap | 1 + 1 file changed, 1 insertion(+) diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index 7bc989b4..f696ddae 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -291,6 +291,7 @@ Object { "getApiV4": [Function], "getApiV5": [Function], "getTcM2mToken": [Function], + "proxyApi": [Function], }, "billing": Object { "default": [Function], From 4be3737977d12dfbd1f9f06e917b78bad5423c48 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Thu, 11 Jun 2020 12:28:25 +0530 Subject: [PATCH 028/144] npm. bump up 1000.19.13 for #4384 https://github.com/topcoder-platform/community-app/issues/4383 https://github.com/topcoder-platform/community-app/pull/4501 https://github.com/topcoder-platform/topcoder-react-lib/pull/184 https://github.com/topcoder-platform/topcoder-react-lib/pull/186 1000.19.13 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 546c9ca2..c0bffb2e 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.19.10", + "version": "1000.19.13", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From b178cdadae1d11b3020966d3c5be2983e06861ea Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Thu, 11 Jun 2020 17:58:45 +0530 Subject: [PATCH 029/144] bump up 1000.19.14 fix for #4390 https://github.com/topcoder-platform/community-app/issues/4380 luiz https://github.com/topcoder-platform/community-app/pull/4512 https://github.com/topcoder-platform/topcoder-react-lib/pull/187 1000.19.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c0bffb2e..8374561d 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.19.13", + "version": "1000.19.14", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From ccb4a93235205a472609fb03207659b88c2610e2 Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda <nursoltan.s@gmail.com> Date: Fri, 12 Jun 2020 13:18:51 +0800 Subject: [PATCH 030/144] fix issue 4519 --- src/actions/members.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/actions/members.js b/src/actions/members.js index acee1ce9..ac7bd701 100644 --- a/src/actions/members.js +++ b/src/actions/members.js @@ -245,7 +245,7 @@ async function getSubtrackChallengesInit(handle, uuid) { */ async function getSubtrackChallengesDone( uuid, handle, tokenV3, track, subTrack, pageNum, pageSize, - refresh, + refresh, userId, ) { const filter = { status: 'Completed', @@ -260,7 +260,7 @@ async function getSubtrackChallengesDone( params.offset = pageNum * pageSize; const service = getChallengesService(tokenV3); - return service.getUserChallenges(handle, filter, params) + return service.getUserChallenges(userId, filter, params) .then(res => ({ uuid, challenges: res.challenges, From 7c81d7b4195bea6e89d8fefa5fd7444edc28e3ea Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Fri, 12 Jun 2020 14:36:57 +0530 Subject: [PATCH 031/144] npm bump up 1000.19.15 https://github.com/topcoder-platform/community-app/issues/4519 nursoltan https://github.com/topcoder-platform/community-app/pull/4525 https://github.com/topcoder-platform/topcoder-react-lib/pull/189 1000.19.15 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8374561d..a9baf4ea 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.19.14", + "version": "1000.19.15", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From b9ad775d3203298100f69159f0436bd2b445f04f Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Fri, 12 Jun 2020 12:17:19 -0300 Subject: [PATCH 032/144] Removed proxyApi --- src/services/api.js | 18 ------------------ src/services/challenges.js | 21 +++++++++++++++++---- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/services/api.js b/src/services/api.js index fffbc7c9..4530a4a3 100644 --- a/src/services/api.js +++ b/src/services/api.js @@ -290,21 +290,3 @@ export async function getTcM2mToken() { const token = await m2m.getMachineToken(TC_M2M.CLIENT_ID, TC_M2M.CLIENT_SECRET); return token; } - -/** - * Call API via proxy - * - * @param {String} url to API endpoint - */ -export async function proxyApi(endpoint) { - let domain = ''; - if (isomorphy.isServerSide()) { - domain = `http://${config.ENV.HOST || 'localhost'}:${config.ENV.PORT || 3000}`; - } - const url = `${domain}/community-app-assets/api${endpoint}`; - let res = await fetch(url); - if (!res.ok) throw new Error(res.statusText); - res = (await res.json()); - if (res.message) throw new Error(res.message); - return res; -} diff --git a/src/services/challenges.js b/src/services/challenges.js index f16a8a33..7269898e 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -11,7 +11,7 @@ import { decodeToken } from 'tc-accounts'; import logger from '../utils/logger'; import { setErrorIcon, ERROR_ICON_TYPES } from '../utils/errors'; import { COMPETITION_TRACKS, getApiResponsePayload } from '../utils/tc'; -import { getApi, proxyApi } from './api'; +import { getApi } from './api'; import { getService as getMembersService } from './members'; export const ORDER_BY = { @@ -200,7 +200,6 @@ class ChallengesService { apiV3: getApi('V3', tokenV3), getChallenges, getMemberChallenges, - proxyApi, tokenV2, tokenV3, memberService: getMembersService(), @@ -360,7 +359,19 @@ class ChallengesService { * @return {Promise} Resolves to the challenge registrants array. */ async getChallengeRegistrants(challengeId) { - const registrants = await this.private.proxyApi(`/challenges/${challengeId}/registrants`); + const roleId = await this.getRoleId('Submitter'); + const params = { + challengeId, + roleId, + }; + + const registrants = await this.private.apiV5.get(`/resources?${qs.stringify(params)}`) + .then(checkErrorV5).then(res => res.result); + + if (_.isEmpty(registrants)) { + throw new Error('Resource Role not found!'); + } + return registrants || []; } @@ -526,8 +537,10 @@ class ChallengesService { async getRoleId(roleName) { const params = { name: roleName, + isActive: true, }; - const roles = await this.private.proxyApi(`/challenges/roleId?${qs.stringify(params)}`); + const roles = await this.private.apiV5.get(`/resource-roles?${qs.stringify(params)}`) + .then(checkErrorV5).then(res => res.result); if (_.isEmpty(roles)) { throw new Error('Resource Role not found!'); From bfa91c289d98c0c13d2a042ec2d7756afd509239 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Fri, 12 Jun 2020 12:17:49 -0300 Subject: [PATCH 033/144] TEMP FIX - Registrants and isRegistered --- src/services/challenges.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 7269898e..2ae8ebcb 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -325,8 +325,10 @@ class ChallengesService { * @return {Promise} Resolves to the challenge object. */ async getChallengeDetails(challengeId) { + const user = decodeToken(this.private.tokenV3); let challenge = {}; let isLegacyChallenge = false; + let isRegistered = false; // condition based on ROUTE used for Review Opportunities, change if needed if (/^[\d]{5,8}$/.test(challengeId)) { isLegacyChallenge = true; @@ -337,10 +339,22 @@ class ChallengesService { .then(res => res.challenges); } - const registrants = await this.getChallengeRegistrants(challenge.id); - challenge.registrants = registrants; + // TEMP FIX until API was fixed + try { + const registrants = await this.getChallengeRegistrants(challenge.id); + challenge.registrants = registrants; + } catch (err) { + challenge.registrants = []; + } + + if (user) { + const userChallenges = await this.private.apiV5.get(`/resources/${user.userId}/challenges`) + .then(checkErrorV5).then(res => res.result); + isRegistered = _.includes(userChallenges, challengeId); + } challenge.isLegacyChallenge = isLegacyChallenge; + challenge.isRegistered = isRegistered; challenge.events = _.map(challenge.events, e => ({ eventName: e.key, From 3b7222c9b4a9e0dc2f9b9e0b5f9025c21e36a80b Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Fri, 12 Jun 2020 12:28:17 -0300 Subject: [PATCH 034/144] Fix snapshot --- __tests__/__snapshots__/index.js.snap | 1 - 1 file changed, 1 deletion(-) diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index f696ddae..7bc989b4 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -291,7 +291,6 @@ Object { "getApiV4": [Function], "getApiV5": [Function], "getTcM2mToken": [Function], - "proxyApi": [Function], }, "billing": Object { "default": [Function], From b4baccc73a82bcdaa850d38acbae7035fb9ae1a7 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Fri, 12 Jun 2020 21:20:32 +0530 Subject: [PATCH 035/144] fix: for #4380 https://github.com/topcoder-platform/community-app/issues/4380 luiz https://github.com/topcoder-platform/community-app/pull/4512 https://github.com/topcoder-platform/topcoder-react-lib/pull/187 1000.19.14 temp fix https://github.com/topcoder-platform/community-app/pull/4526 https://github.com/topcoder-platform/topcoder-react-lib/pull/190 1000.19.16 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a9baf4ea..820b29d1 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.19.15", + "version": "1000.19.16", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 1934269eb1e0619c3979d7d5f0853557c89330be Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Sat, 13 Jun 2020 08:36:22 -0300 Subject: [PATCH 036/144] Fix get memberId via decode() --- src/services/challenges.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 2ae8ebcb..c68712c5 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -325,7 +325,7 @@ class ChallengesService { * @return {Promise} Resolves to the challenge object. */ async getChallengeDetails(challengeId) { - const user = decodeToken(this.private.tokenV3); + const memberId = this.private.tokenV3 ? decodeToken(this.private.tokenV3).userId : null; let challenge = {}; let isLegacyChallenge = false; let isRegistered = false; @@ -347,8 +347,8 @@ class ChallengesService { challenge.registrants = []; } - if (user) { - const userChallenges = await this.private.apiV5.get(`/resources/${user.userId}/challenges`) + if (memberId) { + const userChallenges = await this.private.apiV5.get(`/resources/${memberId}/challenges`) .then(checkErrorV5).then(res => res.result); isRegistered = _.includes(userChallenges, challengeId); } From a9113ac58bd3cfa7622a3faec3d254c18de0398a Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Sun, 14 Jun 2020 08:11:26 +0530 Subject: [PATCH 037/144] fix: hot fix for #4380 https://github.com/topcoder-platform/community-app/issues/4380 luiz https://github.com/topcoder-platform/community-app/pull/4512 https://github.com/topcoder-platform/topcoder-react-lib/pull/187 1000.19.14 temp fix https://github.com/topcoder-platform/community-app/pull/4526 https://github.com/topcoder-platform/topcoder-react-lib/pull/190 1000.19.16 hotfix https://github.com/topcoder-platform/topcoder-react-lib/pull/191 1000.19.17 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 820b29d1..940f8bb6 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.19.16", + "version": "1000.19.17", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From bd2aec70f52ee40eeb1900c2b83f03af88a42422 Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Mon, 15 Jun 2020 05:37:58 +0530 Subject: [PATCH 038/144] changes for issue #4491 --- src/services/lookup.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/services/lookup.js b/src/services/lookup.js index 9770b97e..cd2b99e7 100644 --- a/src/services/lookup.js +++ b/src/services/lookup.js @@ -112,9 +112,12 @@ class LookupService { * @return {Promise} Resolves to the review types. */ async getReviewTypes() { - const res = await this.private.apiV5.get('/reviewTypes'); - const jsonResult = await res.json(); - return jsonResult; + if (typeof this.private.tokenV3 !== 'undefined') { + const res = await this.private.apiV5.get('/reviewTypes'); + const jsonResult = await res.json(); + return jsonResult; + } + return []; } } From e85b7d42d341a2a2cdb59bd94a96511022b054a7 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Mon, 15 Jun 2020 00:46:07 -0300 Subject: [PATCH 039/144] Fix group addMember call --- src/services/groups.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/groups.js b/src/services/groups.js index 69603c0f..ecd6fda0 100644 --- a/src/services/groups.js +++ b/src/services/groups.js @@ -210,7 +210,7 @@ class GroupService { */ async addMember(groupId, memberId, membershipType) { const response = await this.private.api.postJson(`/groups/${groupId}/members`, { - param: { memberId, membershipType }, + memberId, membershipType, }); return handleApiResponse(response); From ce7587661dbc7a622f5511e1e31e48b26e68ee04 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Mon, 15 Jun 2020 16:36:47 +0530 Subject: [PATCH 040/144] fix for #4491 https://github.com/topcoder-platform/community-app/issues/4491 simran https://github.com/topcoder-platform/topcoder-react-lib/pull/192 1000.19.18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 940f8bb6..555048d4 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.19.17", + "version": "1000.19.18", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From fc7ae1f10d67b329c2026f6b19d9f840d65418b5 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 16 Jun 2020 04:29:11 -0300 Subject: [PATCH 041/144] Updated loadProfileDone() to use V5 API --- src/actions/auth.js | 8 +++++--- src/services/groups.js | 4 ++-- src/utils/challenge/filter.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/actions/auth.js b/src/actions/auth.js index c585ec71..38f4f85f 100644 --- a/src/actions/auth.js +++ b/src/actions/auth.js @@ -16,12 +16,14 @@ import { getApi } from '../services/api'; function loadProfileDone(userTokenV3) { if (!userTokenV3) return Promise.resolve(null); const user = decodeToken(userTokenV3); - const api = getApi('V3', userTokenV3); + const api = getApi('V5', userTokenV3); return Promise.all([ api.get(`/members/${user.handle}`) - .then(res => res.json()).then(res => (res.result.status === 200 ? res.result.content : {})), + .then(res => (res.ok ? res.json() : new Error(res.statusText))) + .then(res => (res.message ? new Error(res.message) : res[0])), api.get(`/groups?memberId=${user.userId}&membershipType=user`) - .then(res => res.json()).then(res => (res.result.status === 200 ? res.result.content : [])), + .then(res => (res.ok ? res.json() : new Error(res.statusText))) + .then(res => (res.message ? new Error(res.message) : res)), ]).then(([profile, groups]) => ({ ...profile, groups })); } diff --git a/src/services/groups.js b/src/services/groups.js index ecd6fda0..a3b42a80 100644 --- a/src/services/groups.js +++ b/src/services/groups.js @@ -170,8 +170,8 @@ function mergeGroup(groups, group) { * @param {Object} group * @return {String[]} Array of IDs. */ -export function reduceGroupIds({ oldId, subGroups }) { - let res = [oldId]; +export function reduceGroupIds({ id, subGroups }) { + let res = [id]; if (subGroups) { subGroups.forEach((g) => { res = res.concat(reduceGroupIds(g)); diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index fcaf1924..0f8fac7f 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -382,7 +382,7 @@ export function mapToBackend(filter) { if (filter.or) return {}; const res = {}; - if (filter.groupIds) res.groupIds = filter.groupIds.join(','); + if (filter.groupIds) res.groupIds = filter.groupIds; // filter.groupIds.join(','); /* NOTE: Right now the frontend challenge filter by tag works different, * it looks for matches in the challenge name OR in the techs / platforms. */ From ee1759fb7c209bc992827710a1ee3da1f8208ee7 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 16 Jun 2020 07:04:52 -0300 Subject: [PATCH 042/144] issue-4380 - Hotfix --- src/services/challenges.js | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 63fd6453..31f8fa3f 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -339,18 +339,11 @@ class ChallengesService { .then(res => res.challenges); } - // TEMP FIX until API was fixed - try { - const registrants = await this.getChallengeRegistrants(challenge.id); - challenge.registrants = registrants; - } catch (err) { - challenge.registrants = []; - } + const registrants = await this.getChallengeRegistrants(challenge.id); + challenge.registrants = registrants; if (memberId) { - const userChallenges = await this.private.apiV5.get(`/resources/${memberId}/challenges`) - .then(checkErrorV5).then(res => res.result); - isRegistered = _.includes(userChallenges, challengeId); + isRegistered = _.some(registrants, r => r.memberId === memberId); } challenge.isLegacyChallenge = isLegacyChallenge; @@ -373,19 +366,15 @@ class ChallengesService { * @return {Promise} Resolves to the challenge registrants array. */ async getChallengeRegistrants(challengeId) { - const roleId = await this.getRoleId('Submitter'); + /* If no token provided, resource will return Submitter role only */ const params = { challengeId, - roleId, + roleId: this.private.tokenV3 ? await this.getRoleId('Submitter') : '', }; const registrants = await this.private.apiV5.get(`/resources?${qs.stringify(params)}`) .then(checkErrorV5).then(res => res.result); - if (_.isEmpty(registrants)) { - throw new Error('Resource Role not found!'); - } - return registrants || []; } From 5a24a45db3fd7096721868dc4d8e5f33676b6ac5 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Tue, 16 Jun 2020 16:36:08 +0530 Subject: [PATCH 043/144] fix: for 4380 https://github.com/topcoder-platform/community-app/issues/4380 luiz https://github.com/topcoder-platform/community-app/pull/4512 https://github.com/topcoder-platform/topcoder-react-lib/pull/187 1000.19.14 temp fix https://github.com/topcoder-platform/community-app/pull/4526 https://github.com/topcoder-platform/topcoder-react-lib/pull/190 1000.19.16 hotfix https://github.com/topcoder-platform/topcoder-react-lib/pull/191 1000.19.17 fix https://github.com/topcoder-platform/topcoder-react-lib/pull/193 1000.19.19 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 555048d4..b9b12a56 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.19.18", + "version": "1000.19.19", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 19790eb4c95d2ff40bd3c3744ce5c9fcddcb6d8c Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 16 Jun 2020 09:41:10 -0300 Subject: [PATCH 044/144] TEMP fix to colorStyle in registrants return. --- src/services/challenges.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 31f8fa3f..5ed8c30c 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -339,7 +339,11 @@ class ChallengesService { .then(res => res.challenges); } - const registrants = await this.getChallengeRegistrants(challenge.id); + let registrants = await this.getChallengeRegistrants(challenge.id); + // This TEMP fix to colorStyle, this will be fixed with issue #4530 + registrants = _.map(registrants, r => ({ + ...r, colorStyle: 'color: #151516', + })); challenge.registrants = registrants; if (memberId) { From dc5c430988d1dd095fbff222c2db5c6688af5666 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Tue, 16 Jun 2020 18:28:18 +0530 Subject: [PATCH 045/144] fix: for #4537 https://github.com/topcoder-platform/community-app/issues/4537 luiz https://github.com/topcoder-platform/community-app/pull/4543 https://github.com/topcoder-platform/topcoder-react-lib/pull/195 1000.19.20 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b9b12a56..9b6f9c11 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.19.19", + "version": "1000.19.20", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From e5c288643692fb2a4c0ed19a072da933107ecbab Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Wed, 17 Jun 2020 11:24:22 +0530 Subject: [PATCH 046/144] fix for issue #4541 --- src/services/challenges.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 63fd6453..2e10690a 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -146,18 +146,12 @@ class ChallengesService { }; const url = `${endpoint}?${qs.stringify(query)}`; const res = await this.private.apiV5.get(url).then(checkErrorV5); - let myChallenges; - if (typeof this.private.tokenV3 !== 'undefined') { - const { userId } = decodeToken(this.private.tokenV3); - myChallenges = await this.private.apiV5.get(`/resources/${userId}/challenges`) - .then(checkErrorV5).then(userChallenges => userChallenges); - } return { challenges: res.result || [], totalCount: res.headers.get('x-total'), meta: { allChallengesCount: res.headers.get('x-total'), - myChallengesCount: (myChallenges && myChallenges.headers.get('x-total')) || 0, + myChallengesCount: 0, ongoingChallengesCount: 0, openChallengesCount: 0, totalCount: res.headers.get('x-total'), @@ -440,16 +434,9 @@ class ChallengesService { * @return {Promise} Resolves to the api response. */ async getChallenges(filters, params) { - const memberId = this.private.tokenV3 ? decodeToken(this.private.tokenV3).userId : null; - let userChallenges = []; - if (memberId) { - userChallenges = await this.private.apiV5.get(`/resources/${memberId}/challenges`) - .then(checkErrorV5).then(res => res.result); - } return this.private.getChallenges('/challenges/', filters, params) .then((res) => { - res.challenges.forEach(item => normalizeChallenge(item, - userChallenges.includes(item.id) ? memberId : null)); + res.challenges.forEach(item => normalizeChallenge(item)); return res; }); } From a4f81b31b7dc11810cd6fe4335d94e540868e907 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Wed, 17 Jun 2020 11:39:16 +0530 Subject: [PATCH 047/144] fix: for #4541 https://github.com/topcoder-platform/community-app/issues/4541 simran https://github.com/topcoder-platform/topcoder-react-lib/pull/196 1000.19.21 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b6f9c11..35e88e85 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.19.20", + "version": "1000.19.21", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From e2a4188f116b3c222579e0018019763ee43cf22d Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Wed, 17 Jun 2020 07:17:46 -0300 Subject: [PATCH 048/144] Challenge Details - Get submissions and merge with challenge return --- src/services/challenges.js | 74 +++++++++++++++++++++++++++---------- src/services/submissions.js | 21 +++++++++++ 2 files changed, 76 insertions(+), 19 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 5ed8c30c..6d94e168 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -13,6 +13,7 @@ import { setErrorIcon, ERROR_ICON_TYPES } from '../utils/errors'; import { COMPETITION_TRACKS, getApiResponsePayload } from '../utils/tc'; import { getApi } from './api'; import { getService as getMembersService } from './members'; +import { getService as getSubmissionsService } from './submissions'; export const ORDER_BY = { SUBMISSION_END_DATE: 'submissionEndDate', @@ -203,6 +204,7 @@ class ChallengesService { tokenV2, tokenV3, memberService: getMembersService(), + submissionsService: getSubmissionsService(tokenV3), }; } @@ -327,8 +329,11 @@ class ChallengesService { async getChallengeDetails(challengeId) { const memberId = this.private.tokenV3 ? decodeToken(this.private.tokenV3).userId : null; let challenge = {}; + let registrants = []; + let submissions = []; let isLegacyChallenge = false; let isRegistered = false; + // condition based on ROUTE used for Review Opportunities, change if needed if (/^[\d]{5,8}$/.test(challengeId)) { isLegacyChallenge = true; @@ -339,28 +344,59 @@ class ChallengesService { .then(res => res.challenges); } - let registrants = await this.getChallengeRegistrants(challenge.id); - // This TEMP fix to colorStyle, this will be fixed with issue #4530 - registrants = _.map(registrants, r => ({ - ...r, colorStyle: 'color: #151516', - })); - challenge.registrants = registrants; + if (challenge) { + registrants = await this.getChallengeRegistrants(challenge.id); + + // This TEMP fix to colorStyle, this will be fixed with issue #4530 + registrants = _.map(registrants, r => ({ + ...r, colorStyle: 'color: #151516', + })); + + /* Prepare data to logged user */ + if (memberId) { + isRegistered = _.some(registrants, r => r.memberId === memberId); + + /** + * TODO: Currenlty using legacyId until submissions_api fix issue with UUID + */ + const subParams = { + challengeId: challenge.legacyId, + perPage: 100, + }; + submissions = await this.private.submissionsService.getSubmissions(subParams); + + if (submissions) { + // Remove AV Scan, SonarQube Review and Virus Scan review types + const reviewScans = await this.private.submissionsService.getScanReviewIds(); + submissions.forEach((s, i) => { + submissions[i].review = _.reject(s.review, r => _.includes(reviewScans, r.typeId)); + }); + + // Add submission date to registrants + registrants.forEach((r, i) => { + const submission = submissions.find(s => s.memberId === Number(r.memberId)); + if (submission) { + registrants[i].submissionDate = submission.created; + } + }); + } + } - if (memberId) { - isRegistered = _.some(registrants, r => r.memberId === memberId); + challenge = { + ...challenge, + isLegacyChallenge, + isRegistered, + registrants, + submissions, + events: _.map(challenge.events, e => ({ + eventName: e.key, + eventId: e.id, + description: e.name, + })), + fetchedWithAuth: Boolean(this.private.apiV5.private.token), + }; } - challenge.isLegacyChallenge = isLegacyChallenge; - challenge.isRegistered = isRegistered; - - challenge.events = _.map(challenge.events, e => ({ - eventName: e.key, - eventId: e.id, - description: e.name, - })); - - challenge.fetchedWithAuth = Boolean(this.private.apiV5.private.token); - return challenge; } diff --git a/src/services/submissions.js b/src/services/submissions.js index d8342b77..36e78fb6 100644 --- a/src/services/submissions.js +++ b/src/services/submissions.js @@ -3,6 +3,7 @@ * @desc This module provides a service for convenient manipulation with * Topcoder submissions via TC API. Currently only used for MM challenges */ +import _ from 'lodash'; import qs from 'qs'; import { getApi } from './api'; @@ -39,6 +40,26 @@ class SubmissionsService { .then(res => res); } + /** + * Get scan reviews types + * @returns {Promise} Resolves to the api response. + */ + async getScanReviewIds() { + const reviews = await Promise.all([ + this.private.apiV5.get('/reviewTypes?name=AV Scan') + .then(res => (res.ok ? res.json() : new Error(res.statusText))) + .then(res => res), + this.private.apiV5.get('/reviewTypes?name=SonarQube Review') + .then(res => (res.ok ? res.json() : new Error(res.statusText))) + .then(res => res), + this.private.apiV5.get('/reviewTypes?name=Virus Scan') + .then(res => (res.ok ? res.json() : new Error(res.statusText))) + .then(res => res), + ]).then(([av, sonar, virus]) => (_.concat(av, sonar, virus))); + + return reviews.map(r => r.id); + } + /** * Get submission information by submission id * @param submissionId The submission id From 0df81e44a4ea481ea67d21e8aee1146cedf574fe Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Wed, 17 Jun 2020 16:47:38 +0530 Subject: [PATCH 049/144] fix: for #4536 https://github.com/topcoder-platform/community-app/issues/4536 luiz https://github.com/topcoder-platform/community-app/pull/4550 https://github.com/topcoder-platform/topcoder-react-lib/pull/197 1000.19.22 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 35e88e85..ae0c3eb7 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.19.21", + "version": "1000.19.22", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From b6ae62532eb0075d755557b8652b50178684d39e Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda <nursoltan.s@gmail.com> Date: Thu, 18 Jun 2020 17:40:28 +0800 Subject: [PATCH 050/144] fix #4559 --- src/services/challenges.js | 10 ++++++++++ src/utils/challenge/filter.js | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index ea3818cb..7f15c32b 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -517,6 +517,16 @@ class ChallengesService { }; } + /** + * Gets user resources. + * @param {String} userId User id whose challenges we want to fetch. + * @return {Promise} Resolves to the api response. + */ + async getUserResources(userId) { + const res = await this.private.apiV5.get(`/resources/${userId}/challenges`); + return res.json(); + } + /** * Gets marathon matches of the specified user. * @param {String} memberId User whose challenges we want to fetch. diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index fcaf1924..95b6e18a 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -173,8 +173,8 @@ function filterByUpcoming(challenge, state) { } function filterByUsers(challenge, state) { - if (!state.users) return true; - return state.users.find(user => challenge.users[user]); + if (!state.userChallenges) return true; + return state.userChallenges.find(ch => challenge.id === ch); } /** From a3bca94c269cc0ac682e3c1abf4af45eabe3e6d8 Mon Sep 17 00:00:00 2001 From: PrakashDurlabhji <prakashseta@gmail.com> Date: Thu, 18 Jun 2020 17:17:31 +0530 Subject: [PATCH 051/144] Update challenge.js --- src/reducers/challenge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reducers/challenge.js b/src/reducers/challenge.js index 6db8365f..0705ad08 100644 --- a/src/reducers/challenge.js +++ b/src/reducers/challenge.js @@ -171,7 +171,7 @@ function onFetchCheckpointsDone(state, action) { loadingCheckpoints: false, }; } - if (state.details && state.details.id === action.payload.challengeId) { + if (state.details && state.details.legacyId === action.payload.challengeId) { return { ...state, checkpoints: action.payload.checkpoints, From bd5d00d9eb6bf11889987098060d87e856435ed0 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Thu, 18 Jun 2020 17:40:13 +0530 Subject: [PATCH 052/144] fix: for #4516 https://github.com/topcoder-platform/community-app/issues/4516 Prakash https://github.com/topcoder-platform/community-app/pull/4551 https://github.com/topcoder-platform/topcoder-react-lib/pull/199 1000.19.23 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ae0c3eb7..af2e97b8 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.19.22", + "version": "1000.19.23", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From a633cdd43ff629eff6d3da2c74b63570eb14e615 Mon Sep 17 00:00:00 2001 From: sr_jr <simran.topcoder@gmail.com> Date: Fri, 19 Jun 2020 01:37:39 +0530 Subject: [PATCH 053/144] fix for issue #4556 --- src/services/challenges.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index ea3818cb..e3717ae1 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -363,7 +363,7 @@ class ChallengesService { // Remove AV Scan, SonarQube Review and Virus Scan review types const reviewScans = await this.private.submissionsService.getScanReviewIds(); submissions.forEach((s, i) => { - submissions[i].review = _.reject(s.review, r => _.includes(reviewScans, r.typeId)); + submissions[i].review = _.reject(s.review, r => r && _.includes(reviewScans, r.typeId)); }); // Add submission date to registrants From d46cf36b348749545af4bfb57710aff24f5934e4 Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda <nursoltan.s@gmail.com> Date: Fri, 19 Jun 2020 15:23:52 +0800 Subject: [PATCH 054/144] fix my challenges page --- __tests__/__snapshots__/index.js.snap | 2 + src/actions/members.js | 26 ++++++++++ src/reducers/members.js | 39 +++++++++++++++ src/services/members.js | 71 +++++++++++++++++++++++++++ 4 files changed, 138 insertions(+) diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index 7bc989b4..f1c7c70a 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -111,6 +111,8 @@ Object { "getSubtrackChallengesInit": [Function], "getUserMarathonDone": [Function], "getUserMarathonInit": [Function], + "getUserResourcesDone": [Function], + "getUserResourcesInit": [Function], "getUserSrmDone": [Function], "getUserSrmInit": [Function], }, diff --git a/src/actions/members.js b/src/actions/members.js index ac7bd701..13a14fdb 100644 --- a/src/actions/members.js +++ b/src/actions/members.js @@ -357,6 +357,30 @@ async function getUserMarathonDone( })); } +/** + * @static + * @desc Create an action that fetch user registered challenge's resources. + * @param {String} memberId Member id. + * @param {String} uuid Operation UUID. + * @return {Action} + */ +async function getUserResourcesInit(memberId, uuid) { + return { memberId, uuid }; +} + +/** + * @static + * @desc Create an action that fetch user registered challenge's resources. + * @param {String} handle Member handle. + * @param {String} uuid Operation UUID. + * @return {Action} + */ +async function getUserResourcesDone(memberId, tokenV3, uuid) { + const resources = await getService(tokenV3).getUserResources(memberId); + + return { resources, uuid }; +} + export default createActions({ MEMBERS: { DROP: drop, @@ -380,5 +404,7 @@ export default createActions({ GET_USER_SRM_DONE: getUserSRMDone, GET_USER_MARATHON_INIT: getUserMarathonInit, GET_USER_MARATHON_DONE: getUserMarathonDone, + GET_USER_RESOURCES_INIT: getUserResourcesInit, + GET_USER_RESOURCES_DONE: getUserResourcesDone, }, }); diff --git a/src/reducers/members.js b/src/reducers/members.js index 23d0a08b..76c70d52 100644 --- a/src/reducers/members.js +++ b/src/reducers/members.js @@ -426,6 +426,43 @@ function onGetUserMarathonDone(state, { error, payload }) { }; } +/** + * Inits the loading of user challenge resources. + * @param {Object} state + * @param {Object} action + * @return {Object} New state. + */ +function onGetUserResourcesInit(state, { payload }) { + const { uuid } = payload; + return { + ...state, + userResources: { resources: [], loadingUserResources: uuid }, + }; +} + +/** + * Finalizes the loading of user challenge resources. + * @param {Object} state + * @param {Object} action + * @return {Object} New state. + */ +function onGetUserResourcesDone(state, { error, payload }) { + if (error) { + logger.error('Failed to get user resources', payload); + fireErrorMessage('Failed to get user resources', ''); + return state; + } + + const { uuid, resources } = payload; + + if (uuid !== state.userResources.loadingUserResources) return state; + + return { + ...state, + userResources: { resources, loadingUserResources: '' }, + }; +} + /** * Creates a new Members reducer with the specified initial state. * @param {Object} initialState Optional. Initial state. @@ -455,6 +492,8 @@ function create(initialState = {}) { [a.getUserSrmDone]: onGetUserSRMDone, [a.getUserMarathonInit]: onGetUserMarathonInit, [a.getUserMarathonDone]: onGetUserMarathonDone, + [a.getUserResourcesInit]: onGetUserResourcesInit, + [a.getUserResourcesDone]: onGetUserResourcesDone, }, initialState); } diff --git a/src/services/members.js b/src/services/members.js index 128a61f4..a1053553 100644 --- a/src/services/members.js +++ b/src/services/members.js @@ -21,6 +21,7 @@ class MembersService { constructor(tokenV3) { this.private = { api: getApi('V3', tokenV3), + apiV5: getApi('V5', tokenV3), tokenV3, }; } @@ -312,6 +313,76 @@ class MembersService { const res = await this.private.api.get(url); return getApiResponsePayload(res); } + + /** + * Fetch resources roles + * @param {Array} memberId the member id + */ + async getResourceRoles() { + const res = await this.private.apiV5.get('/resource-roles'); + const roles = await res.json(); + return roles; + } + + /** + * Fetch user challenge resources + * @param {Array} challengeId the challenge id + */ + async getChallengeResources(challengeId) { + const url = `/resources?challengeId=${challengeId}`; + let res = null; + + try { + res = await this.private.apiV5.get(url); + } catch (error) { + // logger.error('Failed to load challenge resource', error); + } + + return res.json(); + } + + /** + * Fetch user registered challenge's resources + * @param {Array} memberId the member id + */ + async getUserResources(memberId) { + const url = `/resources/${memberId}/challenges`; + const res = await this.private.apiV5.get(url); + const challenges = await res.json(); + const roles = await this.getResourceRoles(); + const calls = []; + + challenges.forEach(async (ch) => { + calls.push(this.getChallengeResources(ch)); + // try { + // const result = await this.private.apiV5.get(`/resources?challengeId=${ch}`); + // const resources = await result.json(); + // const userResource = _.find(resources, { memberId }); + // if (userResource) { + // const challengeRole = _.find(roles, { id: userResource.roleId }); + // const { name } = challengeRole || ''; + // console.log({ id: userResource.challengeId, name }); + // // results.push({ id: userResource.challengeId, name }); + // } + // } catch (error) { + // // logger.error('Failed to load challenge resource', error); + // } + }); + + return Promise.all(calls).then((resources) => { + const results = []; + resources.forEach((resource) => { + const userResource = _.find(resource, { memberId }); + if (userResource) { + const challengeRole = _.find(roles, { id: userResource.roleId }); + const { name } = challengeRole || ''; + results.push({ id: userResource.challengeId, name }); + } + }); + + return results; + }); + } } let lastInstance = null; From ea649b2822e0b1e5f842c2961931da6be57ed207 Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda <nursoltan.s@gmail.com> Date: Fri, 19 Jun 2020 15:34:12 +0800 Subject: [PATCH 055/144] deleted comment --- src/services/members.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/services/members.js b/src/services/members.js index a1053553..7716c91d 100644 --- a/src/services/members.js +++ b/src/services/members.js @@ -354,19 +354,6 @@ class MembersService { challenges.forEach(async (ch) => { calls.push(this.getChallengeResources(ch)); - // try { - // const result = await this.private.apiV5.get(`/resources?challengeId=${ch}`); - // const resources = await result.json(); - // const userResource = _.find(resources, { memberId }); - // if (userResource) { - // const challengeRole = _.find(roles, { id: userResource.roleId }); - // const { name } = challengeRole || ''; - // console.log({ id: userResource.challengeId, name }); - // // results.push({ id: userResource.challengeId, name }); - // } - // } catch (error) { - // // logger.error('Failed to load challenge resource', error); - // } }); return Promise.all(calls).then((resources) => { From 915166dffd48b8c38b917e1d7bdfcb4d9fe59e50 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Fri, 19 Jun 2020 14:44:07 +0530 Subject: [PATCH 056/144] fix for: #4559 https://github.com/topcoder-platform/community-app/issues/4559 nursoltan https://github.com/topcoder-platform/community-app/pull/4563 https://github.com/topcoder-platform/topcoder-react-lib/pull/198 1000.19.24 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index af2e97b8..ebfb61b9 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.19.23", + "version": "1000.19.24", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 4238394a2de2ec26dba0388f6270a10fe7922d2c Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Fri, 19 Jun 2020 15:22:20 +0530 Subject: [PATCH 057/144] fix: for #4556 https://github.com/topcoder-platform/community-app/issues/4556 simran https://github.com/topcoder-platform/topcoder-react-lib/pull/200 1000.19.25 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ebfb61b9..9b69610c 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.19.24", + "version": "1000.19.25", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 03713ef280754e72afa39de28754c8605594e0af Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Fri, 19 Jun 2020 15:46:19 +0530 Subject: [PATCH 058/144] fix: for #4557 https://github.com/topcoder-platform/community-app/issues/4557 nursoltan https://github.com/topcoder-platform/community-app/pull/4567 https://github.com/topcoder-platform/topcoder-react-lib/pull/201 1000.19.26 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b69610c..fdcb23e9 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.19.25", + "version": "1000.19.26", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 606eb2e78085655d67cba562d87ee92dbc8e41d0 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Fri, 19 Jun 2020 11:01:42 -0300 Subject: [PATCH 059/144] Update Challenges param from groupIds to groups --- src/utils/challenge/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 0f8fac7f..71f1d367 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -382,7 +382,7 @@ export function mapToBackend(filter) { if (filter.or) return {}; const res = {}; - if (filter.groupIds) res.groupIds = filter.groupIds; // filter.groupIds.join(','); + if (filter.groupIds) res.groups = filter.groupIds; /* NOTE: Right now the frontend challenge filter by tag works different, * it looks for matches in the challenge name OR in the techs / platforms. */ From ec7e414193d34a70283ed303f2a6331a3f05ec56 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Sat, 20 Jun 2020 16:19:58 -0300 Subject: [PATCH 060/144] Updated params groupIds to groups --- src/services/__mocks__/challenges.js | 8 ++++---- src/utils/challenge/filter.js | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/services/__mocks__/challenges.js b/src/services/__mocks__/challenges.js index 0dc59e7c..2c5e7ae4 100644 --- a/src/services/__mocks__/challenges.js +++ b/src/services/__mocks__/challenges.js @@ -85,8 +85,8 @@ export function normalizeChallengeDetails(v3, v3Filtered, v3User, v2, username) // Fill missing data from v3_filtered if (v3Filtered) { const groups = {}; - if (v3Filtered.groupIds) { - v3Filtered.groupIds.forEach((id) => { + if (v3Filtered.groups) { + v3Filtered.groups.forEach((id) => { groups[id] = true; }); } @@ -165,8 +165,8 @@ export function normalizeChallengeDetails(v3, v3Filtered, v3User, v2, username) export function normalizeChallenge(challenge, username) { const registrationOpen = challenge.allPhases.filter(d => d.name === 'Registration')[0].isOpen ? 'Yes' : 'No'; const groups = {}; - if (challenge.groupIds) { - challenge.groupIds.forEach((id) => { + if (challenge.groups) { + challenge.groups.forEach((id) => { groups[id] = true; }); } diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 80006db1..cf4cdd1e 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -18,7 +18,7 @@ * endDate {Number|String} - Permits only those challenges with submission * deadline before this date. * - * groupIds {Array} - Permits only the challenges belonging to at least one + * groups {Array} - Permits only the challenges belonging to at least one * of the groups which IDs are presented as keys in this object. * * or {Object[]} - All other filter fields applied to the challenge with AND @@ -71,8 +71,8 @@ import { COMPETITION_TRACKS, REVIEW_OPPORTUNITY_TYPES } from '../tc'; */ function filterByGroupIds(challenge, state) { - if (!state.groupIds) return true; - return state.groupIds.some(id => challenge.groups[id]); + if (!state.groups) return true; + return state.groups.some(id => challenge.groups[id]); } function filterByRegistrationOpen(challenge, state) { @@ -343,7 +343,7 @@ export function combine(...filters) { const res = {}; filters.forEach((filter) => { combineEndDate(res, filter); - combineArrayRules(res, filter, 'groupIds'); + combineArrayRules(res, filter, 'groups'); /* TODO: The registrationOpen rule is just ignored for now. */ combineStartDate(res, filter); combineArrayRules(res, filter, 'or', true); @@ -382,7 +382,7 @@ export function mapToBackend(filter) { if (filter.or) return {}; const res = {}; - if (filter.groupIds) res.groups = filter.groupIds; + if (filter.groups) res.groups = filter.groups; /* NOTE: Right now the frontend challenge filter by tag works different, * it looks for matches in the challenge name OR in the techs / platforms. */ From 0ae4e1e24b07cb469f9c89e60c5605d93a99b69c Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Mon, 22 Jun 2020 00:40:36 -0300 Subject: [PATCH 061/144] Fix challenges filter mapToBackend --- src/utils/challenge/filter.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index cf4cdd1e..ca6de71d 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -379,15 +379,8 @@ export function combine(...filters) { * @return {Object} */ export function mapToBackend(filter) { - if (filter.or) return {}; - const res = {}; if (filter.groups) res.groups = filter.groups; - - /* NOTE: Right now the frontend challenge filter by tag works different, - * it looks for matches in the challenge name OR in the techs / platforms. */ - // if (filter.tags) res.technologies = filter.tags.join(','); - return res; } From 49ba5a12fb0973b97258e0ab8d9ec8389a7715e3 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Mon, 22 Jun 2020 11:34:55 -0300 Subject: [PATCH 062/144] Update auth tests to support v5 API --- __tests__/actions/auth.js | 11 +++++------ config/test.js | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/__tests__/actions/auth.js b/__tests__/actions/auth.js index eff03f17..2922e0b4 100644 --- a/__tests__/actions/auth.js +++ b/__tests__/actions/auth.js @@ -1,17 +1,16 @@ -const MOCK_GROUPS_REQ_URL = 'https://api.topcoder-dev.com/v3/groups?memberId=12345&membershipType=user'; -const MOCK_PROFILE_REQ_URL = 'https://api.topcoder-dev.com/v3/members/username12345'; +const MOCK_GROUPS_REQ_URL = 'https://api.topcoder-dev.com/v5/groups?memberId=12345&membershipType=user'; +const MOCK_PROFILE_REQ_URL = 'https://api.topcoder-dev.com/v5/members/username12345'; jest.mock('isomorphic-fetch', () => jest.fn(url => Promise.resolve({ + ok: true, json: () => { let content; switch (url) { case MOCK_GROUPS_REQ_URL: content = ['Group1', 'Group2']; break; - case MOCK_PROFILE_REQ_URL: content = { userId: 12345 }; break; + case MOCK_PROFILE_REQ_URL: content = [{ userId: 12345 }]; break; default: throw new Error('Unexpected URL!'); } - return { - result: { content, status: 200 }, - }; + return content; }, }))); diff --git a/config/test.js b/config/test.js index add8c31c..1d2ca856 100644 --- a/config/test.js +++ b/config/test.js @@ -2,6 +2,7 @@ module.exports = { API: { V2: 'https://api.topcoder-dev.com/v2', V3: 'https://api.topcoder-dev.com/v3', + V5: 'https://api.topcoder-dev.com/v5', }, dummyConfigKey: 'Dummy config value', SECRET: { From f3ea4dc2b004385d9cdf2c8092123583cffb6b46 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Mon, 22 Jun 2020 11:35:35 -0300 Subject: [PATCH 063/144] Fix auth description v3 to v5 --- src/actions/auth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/actions/auth.js b/src/actions/auth.js index 38f4f85f..0a611f43 100644 --- a/src/actions/auth.js +++ b/src/actions/auth.js @@ -9,7 +9,7 @@ import { getApi } from '../services/api'; /** * @static - * @desc Creates an action that loads Topcoder user profile from v3 API. + * @desc Creates an action that loads Topcoder user profile from v5 API. * @param {String} userTokenV3 v3 authentication token. * @return {Action} */ From 7df5b34e8bbd5137026d0426d363daf17a253ec9 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Tue, 23 Jun 2020 07:14:08 +0530 Subject: [PATCH 064/144] fix: for #4393 https://github.com/topcoder-platform/community-app/issues/4393 luiz https://github.com/topcoder-platform/community-app/pull/4580 https://github.com/topcoder-platform/topcoder-react-lib/pull/194 1000.19.27 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fdcb23e9..09dd2def 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.19.26", + "version": "1000.19.27", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 87e8aad5f19d644784f131c7e3219645d614e8c5 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 23 Jun 2020 19:08:53 -0300 Subject: [PATCH 065/144] Updated terms to use V5 API --- src/actions/terms.js | 28 +++++------ src/reducers/reviewOpportunity.js | 4 +- src/reducers/terms.js | 2 +- src/services/terms.js | 77 ++++++++++++------------------- 4 files changed, 47 insertions(+), 64 deletions(-) diff --git a/src/actions/terms.js b/src/actions/terms.js index 136307df..599a9c79 100644 --- a/src/actions/terms.js +++ b/src/actions/terms.js @@ -32,7 +32,7 @@ function getTermsInit(arg) { * @return {Action} */ function getTermsDone(entity, tokens, mockAgreed) { - const service = getService(tokens.tokenV2); + const service = getService(tokens.tokenV3); let termsPromise; // if mockAgreed=true passed, then we create an array of 10 true which we pass to the @@ -44,7 +44,7 @@ function getTermsDone(entity, tokens, mockAgreed) { switch (entity.type) { case 'challenge': { - termsPromise = service.getChallengeTerms(entity.id, mockAgreedArray); + termsPromise = service.getChallengeTerms(entity.terms, mockAgreedArray); break; } case 'community': { @@ -59,7 +59,7 @@ function getTermsDone(entity, tokens, mockAgreed) { throw new Error(`Entity type '${entity.type}' is not supported by getTermsDone.`); } - return termsPromise.then(res => ({ entity, terms: res.terms })); + return termsPromise.then(res => ({ entity, terms: res })); } /** @@ -123,14 +123,14 @@ function checkStatusDone(entity, tokens) { * @return {Promise} resolves to the list of term objects */ const checkStatus = maxAttempts => getTermsDone(entity, tokens, mockAgreed).then((res) => { - const allAgreed = _.every(res.terms, 'agreed'); + const allAgreed = _.every(res, 'agreed'); // if not all terms are agreed and we still have some attempts to try if (!allAgreed && maxAttempts > 1) { return delay(TIME_OUT).then(() => checkStatus(maxAttempts - 1)); } - return res.terms; + return res; }); return checkStatus(MAX_ATTEMPTS); @@ -152,11 +152,11 @@ function getTermDetailsInit(termId) { * @static * @desc Creates an action that fetches details of the specified term. * @param {Number|String} termId - * @param {String} tokenV2 + * @param {String} tokenV3 * @return {Action} */ -function getTermDetailsDone(termId, tokenV2) { - const service = getService(tokenV2); +function getTermDetailsDone(termId, tokenV3) { + const service = getService(tokenV3); return service.getTermDetails(termId).then(details => ({ termId, details })); } @@ -175,11 +175,11 @@ function getDocuSignUrlInit(templateId) { * @desc Creates an action that generates the url of DoduSign term * @param {Number|String} templateId id of document template to sign * @param {String} returnUrl callback url after finishing singing - * @param {String} tokenV2 auth token + * @param {String} tokenV3 auth token * @return {Action} */ -function getDocuSignUrlDone(templateId, returnUrl, tokenV2) { - const service = getService(tokenV2); +function getDocuSignUrlDone(templateId, returnUrl, tokenV3) { + const service = getService(tokenV3); return service.getDocuSignUrl(templateId, returnUrl) .then(resp => ({ templateId, docuSignUrl: resp.recipientViewUrl })); } @@ -198,11 +198,11 @@ function agreeTermInit(termId) { * @static * @desc Creates an action that agrees to a term. * @param {Number|String} termId id of term - * @param {String} tokenV2 auth token + * @param {String} tokenV3 auth token * @return {Action} */ -function agreeTermDone(termId, tokenV2) { - const service = getService(tokenV2); +function agreeTermDone(termId, tokenV3) { + const service = getService(tokenV3); return service.agreeTerm(termId).then(resp => ({ termId, success: resp.success })); } diff --git a/src/reducers/reviewOpportunity.js b/src/reducers/reviewOpportunity.js index 0bea4116..e1b8d5b8 100644 --- a/src/reducers/reviewOpportunity.js +++ b/src/reducers/reviewOpportunity.js @@ -23,8 +23,8 @@ function buildRequiredTermsList(details) { // Sometimes roles such as Primary Reviewer have no directly equal // terms entry. Include the plain Reviewer terms when present as a back-up. .filter(term => term.role === 'Reviewer' || _.includes(roles, term.role)) - .map(term => _.pick(term, ['termsOfUseId', 'agreed', 'title'])), - term => term.termsOfUseId, + .map(term => _.pick(term, ['id', 'agreed', 'title'])), + term => term.id, ); return requiredTerms || []; diff --git a/src/reducers/terms.js b/src/reducers/terms.js index b6bfdb49..d951643e 100644 --- a/src/reducers/terms.js +++ b/src/reducers/terms.js @@ -181,7 +181,7 @@ function onAgreeTermDone(state, action) { } if (action.payload.success) { const terms = _.cloneDeep(state.terms); - const term = _.find(terms, ['termsOfUseId', action.payload.termId]); + const term = _.find(terms, ['id', action.payload.termId]); term.agreed = true; const selectedTerm = _.find(terms, t => !t.agreed); return { diff --git a/src/services/terms.js b/src/services/terms.js index b34e62e1..a6914bbc 100644 --- a/src/services/terms.js +++ b/src/services/terms.js @@ -8,6 +8,7 @@ import _ from 'lodash'; import { config } from 'topcoder-react-utils'; import { getService as getCommunityService } from './communities'; +import { getService as getChallengeService } from './challenges'; import { getApi } from './api'; /** @@ -15,54 +16,33 @@ import { getApi } from './api'; */ class TermsService { /** - * @param {String} tokenV2 Optional. Auth token for Topcoder API v2. + * @param {String} tokenV3 Optional. Auth token for Topcoder API v3. */ - constructor(tokenV2) { + constructor(tokenV3) { this.private = { - api: getApi('V2', tokenV2), - tokenV2, + api: getApi('V5', tokenV3), + tokenV3, }; } /** * get all terms of specified challenge - * @param {Number|String} challengeId id of the challenge + * @param {Array<String>} terms terms of the challenge * @return {Promise} promise of the request result */ - getChallengeTerms(challengeId) { - if (this.private.tokenV2) { - let registered = false; - return this.private.api.get(`/terms/${challengeId}?role=Submitter`) - .then(res => res.json()) - .then((res) => { - if (res.error) { - if (res.error.details === 'You are already registered for this challenge.') { - registered = true; - } - return this.private.api.get(`/terms/${challengeId}?role=Submitter&noauth=true`) - .then((resp) => { - if (resp.ok) { - return resp.json().then((result) => { - if (registered) { - // eslint-disable-next-line no-param-reassign - _.forEach(result.terms, (t) => { t.agreed = true; }); - } - return result; - }); - } - return new Error(resp.statusText); - }); - } - return res; - }); + async getChallengeTerms(terms) { + if (this.private.tokenV3) { + const challengeService = getChallengeService(this.private.tokenV3); + const roleId = await challengeService.getRoleId('Submitter'); + const registerTerms = _.filter(terms, t => t.roleId === roleId); + + return Promise.all(_.map(registerTerms, term => this.getTermDetails(term.id))) + .then(challengeTerms => ( + _.map(challengeTerms, term => _.pick(term, 'id', 'title', 'agreed')) + )); } - return this.private.api.get(`/terms/${challengeId}?role=Submitter&noauth=true`) - .then((resp) => { - if (resp.ok) { - return resp.json(); - } - throw new Error(resp.statusText); - }); + + return []; } /** @@ -110,7 +90,7 @@ class TermsService { return Promise.resolve(term); } // Otherwise grab new details from terms api - return this.getTermDetails(term.termsOfUseId).then(res => _.pick(res, ['termsOfUseId', 'agreed', 'title'])); + return this.getTermDetails(term.id).then(res => _.pick(res, ['id', 'agreed', 'title'])); }); return Promise.all(promises).then(terms => ({ terms })); @@ -123,8 +103,7 @@ class TermsService { */ getTermDetails(termId) { // looks like server cache responses, to prevent it we add nocache param with always new value - const nocache = (new Date()).getTime(); - return this.private.api.get(`/terms/detail/${termId}?nocache=${nocache}`) + return this.private.api.get(`/terms/${termId}`) .then(res => (res.ok ? res.json() : Promise.reject(res.json()))); } @@ -135,7 +114,11 @@ class TermsService { * @return {Promise} promise of the request result */ getDocuSignUrl(templateId, returnUrl) { - return this.private.api.post(`/terms/docusign/viewURL?templateId=${templateId}&returnUrl=${returnUrl}`) + const params = { + templateId, + returnUrl, + }; + return this.private.api.postJson('/terms/docusignViewURL', params) .then(res => (res.ok ? res.json() : Promise.reject(res.json()))); } @@ -153,20 +136,20 @@ class TermsService { let lastInstance = null; /** * Returns a new or existing terms service. - * @param {String} tokenV2 Optional. Auth token for Topcoder API v2. + * @param {String} tokenV3 Optional. Auth token for Topcoder API v3. * @return {TermsService} Terms service object */ -export function getService(tokenV2) { +export function getService(tokenV3) { /* Because of Topcoder backend restrictions, it is not straightforward to test * terms-related functionality in any other way than just providing an option * to run the app against mock terms service. */ if (config.MOCK_TERMS_SERVICE) { /* eslint-disable global-require */ - return require('./__mocks__/terms').getService(tokenV2); + return require('./__mocks__/terms').getService(tokenV3); /* eslint-enable global-require */ } - if (!lastInstance || (tokenV2 && lastInstance.private.tokenV2 !== tokenV2)) { - lastInstance = new TermsService(tokenV2); + if (!lastInstance || (tokenV3 && lastInstance.private.tokenV3 !== tokenV3)) { + lastInstance = new TermsService(tokenV3); } return lastInstance; } From 5386e8304c728dc41a777aaeb80e7332b903b14d Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Wed, 24 Jun 2020 08:15:37 +0530 Subject: [PATCH 066/144] fix: for #4562 https://github.com/topcoder-platform/community-app/issues/4562 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 09dd2def..0738a07b 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.19.27", + "version": "1000.19.28", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From bfef016bcbb229d885d088f01feb2b6efc9b8390 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Wed, 24 Jun 2020 20:21:22 -0300 Subject: [PATCH 067/144] Update getSubmissionsDone() to use V5 API --- src/actions/challenge.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/actions/challenge.js b/src/actions/challenge.js index 4627c0a3..e15890e8 100644 --- a/src/actions/challenge.js +++ b/src/actions/challenge.js @@ -103,12 +103,12 @@ function getSubmissionsInit(challengeId) { * @desc Creates an action that loads user's submissions to the specified * challenge. * @param {String} challengeId Challenge ID. - * @param {String} tokenV2 Topcoder auth token v2. + * @param {String} tokenV23 Topcoder auth token v3. * @return {Action} */ -function getSubmissionsDone(challengeId, tokenV2) { - return getApi('V2', tokenV2) - .fetch(`/challenges/submissions/${challengeId}/mySubmissions`) +function getSubmissionsDone(challengeId, tokenV3) { + return getApi('V5', tokenV3) + .fetch(`/submissions?challengeId=${challengeId}`) .then(response => response.json()) .then(response => ({ challengeId: _.toString(challengeId), From 04506834fabe78e3e4db3e3a3df97a0c905a3b53 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Thu, 25 Jun 2020 05:38:04 -0300 Subject: [PATCH 068/144] Terms - Fix return data --- src/actions/terms.js | 4 ++-- src/services/terms.js | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/actions/terms.js b/src/actions/terms.js index 599a9c79..bc0a1907 100644 --- a/src/actions/terms.js +++ b/src/actions/terms.js @@ -123,14 +123,14 @@ function checkStatusDone(entity, tokens) { * @return {Promise} resolves to the list of term objects */ const checkStatus = maxAttempts => getTermsDone(entity, tokens, mockAgreed).then((res) => { - const allAgreed = _.every(res, 'agreed'); + const allAgreed = _.every(res.terms, 'agreed'); // if not all terms are agreed and we still have some attempts to try if (!allAgreed && maxAttempts > 1) { return delay(TIME_OUT).then(() => checkStatus(maxAttempts - 1)); } - return res; + return res.terms; }); return checkStatus(MAX_ATTEMPTS); diff --git a/src/services/terms.js b/src/services/terms.js index a6914bbc..224f825a 100644 --- a/src/services/terms.js +++ b/src/services/terms.js @@ -68,9 +68,7 @@ class TermsService { } return []; - }).then(terms => ({ - terms, - })); + }).then(terms => terms); } /** @@ -93,7 +91,7 @@ class TermsService { return this.getTermDetails(term.id).then(res => _.pick(res, ['id', 'agreed', 'title'])); }); - return Promise.all(promises).then(terms => ({ terms })); + return Promise.all(promises).then(terms => terms); } /** From 45d09bb91134371dfbd0930ad8b3e7f709ead958 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Thu, 25 Jun 2020 19:14:57 +0530 Subject: [PATCH 069/144] fix: for #4562 https://github.com/topcoder-platform/community-app/issues/4562 luiz https://github.com/topcoder-platform/community-app/pull/4588 https://github.com/topcoder-platform/topcoder-react-lib/pull/203 1000.19.28 https://github.com/topcoder-platform/community-app/pull/4603 https://github.com/topcoder-platform/topcoder-react-lib/pull/204 1000.19.29 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0738a07b..8c8847f6 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.19.28", + "version": "1000.19.29", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From d593f70eb79a4a3b651ea5e3d9a9f62a8985c855 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Thu, 25 Jun 2020 17:42:55 -0300 Subject: [PATCH 070/144] Updated var type from Number to String to challengeId --- src/actions/challenge.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/actions/challenge.js b/src/actions/challenge.js index e15890e8..9c216226 100644 --- a/src/actions/challenge.js +++ b/src/actions/challenge.js @@ -289,13 +289,13 @@ function fetchCheckpointsDone(tokenV2, challengeId) { response.checkpointResults[index].expanded = false; }); return { - challengeId: Number(challengeId), + challengeId: String(challengeId), checkpoints: response, }; }) .catch(error => ({ error, - challengeId: Number(challengeId), + challengeId: String(challengeId), })); } From 1c8f9f295075f9f5e30f0b77d9b880c65cdacb57 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Thu, 25 Jun 2020 17:44:42 -0300 Subject: [PATCH 071/144] Update getSubmissions to use UUID instead legacyId --- src/services/challenges.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 25811f62..b7967a09 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -350,14 +350,15 @@ class ChallengesService { if (memberId) { isRegistered = _.some(registrants, r => r.memberId === memberId); - /** - * TODO: Currenlty using legacyId until submissions_api fix issue with UUID - */ const subParams = { - challengeId: challenge.legacyId, + challengeId, perPage: 100, }; - submissions = await this.private.submissionsService.getSubmissions(subParams); + try { + submissions = await this.private.submissionsService.getSubmissions(subParams); + } catch (err) { + submissions = []; + } if (submissions) { // Remove AV Scan, SonarQube Review and Virus Scan review types From bed729f4e1c8b9d4bd4683cca2ef0a68d262efec Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Thu, 25 Jun 2020 17:45:17 -0300 Subject: [PATCH 072/144] Added checkErrorV5 to submissions services --- src/services/submissions.js | 40 +++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/services/submissions.js b/src/services/submissions.js index 36e78fb6..12f27021 100644 --- a/src/services/submissions.js +++ b/src/services/submissions.js @@ -5,8 +5,32 @@ */ import _ from 'lodash'; import qs from 'qs'; +import { setErrorIcon, ERROR_ICON_TYPES } from '../utils/errors'; import { getApi } from './api'; +/** + * Helper method that checks for HTTP error response v5 and throws Error in this case. + * @param {Object} res HTTP response object + * @return {Object} API JSON response object + * @private + */ +async function checkErrorV5(res) { + if (!res.ok) { + if (res.status >= 500) { + setErrorIcon(ERROR_ICON_TYPES.API, '/challenges', res.statusText); + } + throw new Error(res.statusText); + } + const jsonRes = (await res.json()); + if (jsonRes.message) { + throw new Error(res.message); + } + return { + result: jsonRes, + headers: res.headers, + }; +} + /** * Submission service. */ @@ -36,8 +60,8 @@ class SubmissionsService { const url = `/submissions?${qs.stringify(query, { encode: false })}`; return this.private.apiV5.get(url) - .then(res => (res.ok ? res.json() : new Error(res.statusText))) - .then(res => res); + .then(checkErrorV5) + .then(res => res.result); } /** @@ -47,14 +71,14 @@ class SubmissionsService { async getScanReviewIds() { const reviews = await Promise.all([ this.private.apiV5.get('/reviewTypes?name=AV Scan') - .then(res => (res.ok ? res.json() : new Error(res.statusText))) - .then(res => res), + .then(checkErrorV5) + .then(res => res.result), this.private.apiV5.get('/reviewTypes?name=SonarQube Review') - .then(res => (res.ok ? res.json() : new Error(res.statusText))) - .then(res => res), + .then(checkErrorV5) + .then(res => res.result), this.private.apiV5.get('/reviewTypes?name=Virus Scan') - .then(res => (res.ok ? res.json() : new Error(res.statusText))) - .then(res => res), + .then(checkErrorV5) + .then(res => res.result), ]).then(([av, sonar, virus]) => (_.concat(av, sonar, virus))); return reviews.map(r => r.id); From 5407a2663414dcce96a8304f4f9f4bb460cc1276 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Mon, 29 Jun 2020 22:43:53 -0300 Subject: [PATCH 073/144] Updated action getSubmissionsDone to use submissionsService --- src/actions/challenge.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/actions/challenge.js b/src/actions/challenge.js index 9c216226..c8fa4ace 100644 --- a/src/actions/challenge.js +++ b/src/actions/challenge.js @@ -7,6 +7,7 @@ import _ from 'lodash'; import { config } from 'topcoder-react-utils'; import { createActions } from 'redux-actions'; +import { decodeToken } from 'tc-accounts'; import { getService as getChallengesService } from '../services/challenges'; import { getService as getSubmissionService } from '../services/submissions'; import { getService as getMemberService } from '../services/members'; @@ -103,16 +104,20 @@ function getSubmissionsInit(challengeId) { * @desc Creates an action that loads user's submissions to the specified * challenge. * @param {String} challengeId Challenge ID. - * @param {String} tokenV23 Topcoder auth token v3. + * @param {String} tokenV3 Topcoder auth token v3. * @return {Action} */ function getSubmissionsDone(challengeId, tokenV3) { - return getApi('V5', tokenV3) - .fetch(`/submissions?challengeId=${challengeId}`) - .then(response => response.json()) - .then(response => ({ + const user = decodeToken(tokenV3); + const submissionsService = getSubmissionService(tokenV3); + const filters = { + challengeId, + memberId: user.userId, + }; + return submissionsService.getSubmissions(filters) + .then(submissions => ({ challengeId: _.toString(challengeId), - submissions: response.submissions, + submissions, })) .catch((error) => { const err = { challengeId: _.toString(challengeId), error }; From 4432f22922739fd79761f7d4ca3a2db6d7bb23c6 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Mon, 29 Jun 2020 22:44:15 -0300 Subject: [PATCH 074/144] Updated deleteSubmissionDone to use V5 API --- src/actions/smp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/actions/smp.js b/src/actions/smp.js index 9c46f513..bded6d70 100644 --- a/src/actions/smp.js +++ b/src/actions/smp.js @@ -22,7 +22,7 @@ function deleteSubmissionInit() {} * @return {Action} */ function deleteSubmissionDone(tokenV3, submissionId) { - return getApi('V3', tokenV3).delete(`/submissions/${submissionId}`) + return getApi('V5', tokenV3).delete(`/submissions/${submissionId}`) .then(() => submissionId); } From 910cebfa23c524cadf6e561e18f20c201c6dabc8 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Mon, 29 Jun 2020 22:44:50 -0300 Subject: [PATCH 075/144] Remove try/catch from get submissions in challenge details --- src/services/challenges.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index b7967a09..079a5ef7 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -354,11 +354,8 @@ class ChallengesService { challengeId, perPage: 100, }; - try { - submissions = await this.private.submissionsService.getSubmissions(subParams); - } catch (err) { - submissions = []; - } + + submissions = await this.private.submissionsService.getSubmissions(subParams); if (submissions) { // Remove AV Scan, SonarQube Review and Virus Scan review types From ca92a7332a9cb413c6a3e4ae7df1b353aa555c2b Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Wed, 1 Jul 2020 19:02:10 +0530 Subject: [PATCH 076/144] fix: for #4582 https://github.com/topcoder-platform/community-app/issues/4582 luiz https://github.com/topcoder-platform/community-app/pull/4605 https://github.com/topcoder-platform/topcoder-react-lib/pull/205 1000.19.30 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8c8847f6..b2650059 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.19.29", + "version": "1000.19.30", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From d5dbe0d951d976a37892501ff38d38efb7676cf1 Mon Sep 17 00:00:00 2001 From: narekcat <narekcat@gmail.com> Date: Fri, 3 Jul 2020 14:07:42 +0400 Subject: [PATCH 077/144] fix: #issue 4619, sync the fields for V3 and V5 for challenge phases --- src/services/reviewOpportunities.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/services/reviewOpportunities.js b/src/services/reviewOpportunities.js index 42ad4844..51af9e44 100644 --- a/src/services/reviewOpportunities.js +++ b/src/services/reviewOpportunities.js @@ -22,6 +22,22 @@ export function normalizeChallenges(challenges) { } return challenges; } + +/** + * Sync the fields of V3 and V5 for front-end to process successfully + * @param challenge - challenge to normalize + */ +function normalizeChallengePhases(challenge) { + return { + ...challenge, + phases: _.map(challenge.phases, phase => ({ + ...phase, + scheduledStartDate: phase.scheduledStartTime, + scheduledEndDate: phase.scheduledEndTime, + })), + }; +} + /** * Service class. */ @@ -64,8 +80,10 @@ class ReviewOpportunitiesService { .then(res => res.json()) .then(res => ( res.result.status === 200 - ? res.result.content - : Promise.reject(res.result) + ? { + ...res.result.content, + challenge: normalizeChallengePhases(res.result.content.challenge), + } : Promise.reject(res.result) )); } From 7376517682f431b48e3f20881faf2d5c2267dd0d Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Sat, 4 Jul 2020 08:05:41 +0530 Subject: [PATCH 078/144] fix: for #4619 https://github.com/topcoder-platform/community-app/issues/4619 narekat https://github.com/topcoder-platform/community-app/pull/4624 https://github.com/topcoder-platform/topcoder-react-lib/pull/206 1000.19.31 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b2650059..a9484f2b 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.19.30", + "version": "1000.19.31", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 9c3ad4b1ca01675503899d68793a497e0e53dc6f Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Sat, 4 Jul 2020 08:25:46 +0530 Subject: [PATCH 079/144] fix: for 4619 https://github.com/topcoder-platform/community-app/issues/4619 narekat https://github.com/topcoder-platform/community-app/pull/4624 https://github.com/topcoder-platform/topcoder-react-lib/pull/206 1000.19.31 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a9484f2b..d6af6ca2 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.19.31", + "version": "1000.19.32", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From e3c9499b5f16a6bd3468ecf878aa438404a7d830 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Wed, 8 Jul 2020 20:00:56 -0300 Subject: [PATCH 080/144] change loadProfileDone to use v3 instead v5 API --- src/actions/auth.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/actions/auth.js b/src/actions/auth.js index 0a611f43..f758d9ed 100644 --- a/src/actions/auth.js +++ b/src/actions/auth.js @@ -5,23 +5,23 @@ import { createActions } from 'redux-actions'; import { decodeToken } from 'tc-accounts'; -import { getApi } from '../services/api'; +import { getApiV3, getApiV5 } from '../services/api'; /** * @static - * @desc Creates an action that loads Topcoder user profile from v5 API. + * @desc Creates an action that loads Topcoder user profile from v3 API. * @param {String} userTokenV3 v3 authentication token. * @return {Action} */ function loadProfileDone(userTokenV3) { if (!userTokenV3) return Promise.resolve(null); const user = decodeToken(userTokenV3); - const api = getApi('V5', userTokenV3); + const apiV3 = getApiV3(userTokenV3); + const apiV5 = getApiV5(userTokenV3); return Promise.all([ - api.get(`/members/${user.handle}`) - .then(res => (res.ok ? res.json() : new Error(res.statusText))) - .then(res => (res.message ? new Error(res.message) : res[0])), - api.get(`/groups?memberId=${user.userId}&membershipType=user`) + apiV3.get(`/members/${user.handle}`) + .then(res => res.json()).then(res => (res.result.status === 200 ? res.result.content : {})), + apiV5.get(`/groups?memberId=${user.userId}&membershipType=user`) .then(res => (res.ok ? res.json() : new Error(res.statusText))) .then(res => (res.message ? new Error(res.message) : res)), ]).then(([profile, groups]) => ({ ...profile, groups })); From 4b2df6b885cddafa5671934b91552b8a47ad5997 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Wed, 8 Jul 2020 20:18:56 -0300 Subject: [PATCH 081/144] Update tests --- __tests__/actions/auth.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/__tests__/actions/auth.js b/__tests__/actions/auth.js index 2922e0b4..a36ef7e3 100644 --- a/__tests__/actions/auth.js +++ b/__tests__/actions/auth.js @@ -1,13 +1,17 @@ const MOCK_GROUPS_REQ_URL = 'https://api.topcoder-dev.com/v5/groups?memberId=12345&membershipType=user'; -const MOCK_PROFILE_REQ_URL = 'https://api.topcoder-dev.com/v5/members/username12345'; +const MOCK_PROFILE_REQ_URL = 'https://api.topcoder-dev.com/v3/members/username12345'; jest.mock('isomorphic-fetch', () => jest.fn(url => Promise.resolve({ ok: true, json: () => { let content; switch (url) { - case MOCK_GROUPS_REQ_URL: content = ['Group1', 'Group2']; break; - case MOCK_PROFILE_REQ_URL: content = [{ userId: 12345 }]; break; + case MOCK_GROUPS_REQ_URL: + content = ['Group1', 'Group2']; + break; + case MOCK_PROFILE_REQ_URL: + content = { result: { content: { userId: 12345 }, status: 200 } }; + break; default: throw new Error('Unexpected URL!'); } return content; From f5471db013e344db55ff58806b71b68e0b86019a Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Thu, 9 Jul 2020 13:06:15 +0530 Subject: [PATCH 082/144] fix: for https://github.com/topcoder-platform/community-app/issues/4587 luiz https://github.com/topcoder-platform/topcoder-react-lib/pull/207 1000.19.33 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d6af6ca2..8060f790 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.19.32", + "version": "1000.19.33", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 68222c0cffaffded88e64288b0cffd124d7bfd08 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Fri, 17 Jul 2020 01:01:11 -0300 Subject: [PATCH 083/144] Fix Issue-4648 : Different data type compare --- src/services/challenges.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 079a5ef7..3e4c5358 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -348,7 +348,7 @@ class ChallengesService { /* Prepare data to logged user */ if (memberId) { - isRegistered = _.some(registrants, r => r.memberId === memberId); + isRegistered = _.some(registrants, r => `${r.memberId}` === `${memberId}`); const subParams = { challengeId, @@ -366,7 +366,7 @@ class ChallengesService { // Add submission date to registrants registrants.forEach((r, i) => { - const submission = submissions.find(s => s.memberId === Number(r.memberId)); + const submission = submissions.find(s => `${s.memberId}` === `${r.memberId}`); if (submission) { registrants[i].submissionDate = submission.created; } From db83da0467e39b5186255a090765b25a49492f40 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Fri, 17 Jul 2020 11:47:15 +0530 Subject: [PATCH 084/144] fix: for #4648 https://github.com/topcoder-platform/community-app/issues/4648 luiz "https://github.com/topcoder-platform/topcoder-react-lib/pull/208 https://github.com/topcoder-platform/topcoder-react-lib/pull/210" 1000.19.35 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8060f790..352143fa 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.19.33", + "version": "1000.19.35", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 7fd4bd4d57e3c5931639fd9054c71e500c99feee Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Thu, 23 Jul 2020 09:49:17 -0300 Subject: [PATCH 085/144] Fix var in filterByGroupIds in challenge listing filter --- src/utils/challenge/filter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index ca6de71d..269376ca 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -71,8 +71,8 @@ import { COMPETITION_TRACKS, REVIEW_OPPORTUNITY_TYPES } from '../tc'; */ function filterByGroupIds(challenge, state) { - if (!state.groups) return true; - return state.groups.some(id => challenge.groups[id]); + if (!state.groupIds) return true; + return state.groupIds.some(id => challenge.groups[id]); } function filterByRegistrationOpen(challenge, state) { From fe11ee61b887569f99bdb8868a8e3d364724104a Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Fri, 24 Jul 2020 07:51:14 +0530 Subject: [PATCH 086/144] fix: for #4650 https://github.com/topcoder-platform/community-app/issues/4650 luiz https://github.com/topcoder-platform/community-app/pull/4680 https://github.com/topcoder-platform/topcoder-react-lib/pull/211 1000.19.36 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 352143fa..e00d9d9d 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.19.35", + "version": "1000.19.36", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 50738814672941b0df4031bfd0713f931dc1bd74 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Mon, 27 Jul 2020 07:26:34 +0530 Subject: [PATCH 087/144] fix: for #4650 https://github.com/topcoder-platform/community-app/issues/4650 luiz https://github.com/topcoder-platform/community-app/pull/4680 https://github.com/topcoder-platform/topcoder-react-lib/pull/211 1000.19.37 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e00d9d9d..cce99f5b 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.19.36", + "version": "1000.19.37", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 8ff0d3b203fa5eb1ffb931d7d70a05e49f043a01 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 28 Jul 2020 04:29:55 -0300 Subject: [PATCH 088/144] issue-4673 : Fix checkpoint tab when SRR --- src/reducers/challenge.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/reducers/challenge.js b/src/reducers/challenge.js index 0705ad08..05bb9bc9 100644 --- a/src/reducers/challenge.js +++ b/src/reducers/challenge.js @@ -465,15 +465,25 @@ export function factory(options = {}) { challengeId, tokens.tokenV3, tokens.tokenV2, - )).then((details) => { - const track = _.get(details, 'payload.track', '').toLowerCase(); - const checkpointsPromise = track === 'design' ? ( - redux.resolveAction(actions.challenge.fetchCheckpointsDone(tokens.tokenV2, challengeId)) + )).then((res) => { + const challengeDetails = _.get(res, 'payload', {}); + const track = _.get(challengeDetails, 'legacy.track', ''); + let checkpointsPromise = null; + if (track === 'DESIGN') { + const p = _.get(challengeDetails, 'phases', []) + .filter(x => x.name === 'Checkpoint Review'); + if (p.length && !p[0].isOpen) { + checkpointsPromise = redux.resolveAction( + actions.challenge.fetchCheckpointsDone(tokens.tokenV2, challengeDetails.legacyId), + ); + } + } + const resultsPromise = challengeDetails.status === 'Completed' ? ( + redux.resolveAction( + actions.challenge.loadResultsDone(tokens, challengeId, track.toLowerCase()), + ) ) : null; - const resultsPromise = _.get(details, 'payload.status', '') === 'Completed' ? ( - redux.resolveAction(actions.challenge.loadResultsDone(tokens, challengeId, track)) - ) : null; - return Promise.all([details, checkpointsPromise, resultsPromise]); + return Promise.all([res, checkpointsPromise, resultsPromise]); }).then(([details, checkpoints, results]) => { state = { ...state, From de89e65661340624fd1022396208523395f1468b Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Tue, 28 Jul 2020 19:31:09 +0530 Subject: [PATCH 089/144] fix: for #4673 https://github.com/topcoder-platform/community-app/issues/4673 luiz https://github.com/topcoder-platform/topcoder-react-lib/pull/212 1000.19.38 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cce99f5b..cf192be5 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.19.37", + "version": "1000.19.38", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 74d971b8cdd8a0280fbe247e47935ebe6ee26f8a Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Fri, 31 Jul 2020 03:39:50 -0300 Subject: [PATCH 090/144] issue-4688 : Added ongoing filter to challenges listing --- src/utils/challenge/filter.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 269376ca..d9e6429e 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -130,6 +130,14 @@ function filterByStarted(challenge, state) { return moment(challenge.registrationStartDate).isBefore(Date.now()); } +function filterByOngoing(challenge, state) { + if (_.isUndefined(state.ongoing)) return true; + const registrationPhase = (challenge.phases || []).filter(d => d.name === 'Registration')[0]; + const registrationEndDate = registrationPhase ? registrationPhase.scheduledEndDate + : challenge.registrationEndDate; + return moment(registrationEndDate).isBefore(Date.now()); +} + function filterByStatus(challenge, state) { if (!state.status) return true; return state.status.includes(challenge.status); @@ -219,6 +227,7 @@ export function getFilterFunction(state) { && filterByEndDate(challenge, state) && filterByStartDate(challenge, state) && filterByStarted(challenge, state) + && filterByOngoing(challenge, state) && filterByRegistrationOpen(challenge, state); if (!test && state.or) { let pos = 0; From 70e97da44d8cd1c001ed2815d13d2cb79cc98651 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Fri, 31 Jul 2020 16:29:51 +0530 Subject: [PATCH 091/144] fix: for #4688 https://github.com/topcoder-platform/community-app/issues/4688 luiz https://github.com/topcoder-platform/community-app/pull/4699 https://github.com/topcoder-platform/topcoder-react-lib/pull/213 1000.19.39 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cf192be5..59ec031f 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.19.38", + "version": "1000.19.39", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 80a9b719b02f15e7b0f6196527124f3d801e61b0 Mon Sep 17 00:00:00 2001 From: Cagdas U <cagdasugurlu01@gmail.com> Date: Tue, 4 Aug 2020 19:17:14 +0300 Subject: [PATCH 092/144] fix(ChallengeDetails): return `userDetails.roles` with challenge details --- package-lock.json | 2 +- package.json | 2 +- src/services/challenges.js | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 503042cf..5728771f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "topcoder-react-lib", - "version": "1000.19.2", + "version": "1000.19.39", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 59ec031f..605ac7a7 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.19.39", + "version": "1000.19.40", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", diff --git a/src/services/challenges.js b/src/services/challenges.js index 3e4c5358..4df36f91 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -327,6 +327,7 @@ class ChallengesService { let submissions = []; let isLegacyChallenge = false; let isRegistered = false; + const userDetails = { roles: [] }; // condition based on ROUTE used for Review Opportunities, change if needed if (/^[\d]{5,8}$/.test(challengeId)) { @@ -372,6 +373,7 @@ class ChallengesService { } }); } + userDetails.roles = await this.getUserRolesInChallenge(challengeId); } challenge = { @@ -380,6 +382,7 @@ class ChallengesService { isRegistered, registrants, submissions, + userDetails, events: _.map(challenge.events, e => ({ eventName: e.key, eventId: e.id, @@ -703,8 +706,9 @@ class ChallengesService { */ async getUserRolesInChallenge(challengeId) { const user = decodeToken(this.private.tokenV3); - const url = `/resources?challengeId=${challengeId}?memberHandle=${user.handle}`; - const resources = await this.private.apiV5.get(url); + const url = `/resources?challengeId=${challengeId}&memberHandle=${user.handle}`; + const getResourcesResponse = await this.private.apiV5.get(url); + const resources = await getResourcesResponse.json(); if (resources) return _.map(resources, 'roleId'); throw new Error(`Failed to fetch user role from challenge #${challengeId}`); } From e11bded2ec9894775c99489d6252def65eec8e76 Mon Sep 17 00:00:00 2001 From: Cagdas U <cagdasugurlu01@gmail.com> Date: Tue, 4 Aug 2020 20:20:29 +0300 Subject: [PATCH 093/144] fix(ChallengeDetails): include only user's own roles at `getUserRolesInChallenge` --- src/services/challenges.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 4df36f91..ecb7e1d4 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -709,7 +709,7 @@ class ChallengesService { const url = `/resources?challengeId=${challengeId}&memberHandle=${user.handle}`; const getResourcesResponse = await this.private.apiV5.get(url); const resources = await getResourcesResponse.json(); - if (resources) return _.map(resources, 'roleId'); + if (resources) return _.map(_.filter(resources, r => r.memberHandle === user.handle), 'roleId'); throw new Error(`Failed to fetch user role from challenge #${challengeId}`); } } From 52ccdd5e43c716780b7bf6143affd5a7dc594d18 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 4 Aug 2020 20:30:50 -0300 Subject: [PATCH 094/144] issue-4700 : Filter registrants with Submitters only --- src/services/challenges.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 3e4c5358..1cd3d823 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -399,14 +399,18 @@ class ChallengesService { */ async getChallengeRegistrants(challengeId) { /* If no token provided, resource will return Submitter role only */ + const roleId = this.private.tokenV3 ? await this.getRoleId('Submitter') : ''; const params = { challengeId, - roleId: this.private.tokenV3 ? await this.getRoleId('Submitter') : '', + roleId, }; - const registrants = await this.private.apiV5.get(`/resources?${qs.stringify(params)}`) + let registrants = await this.private.apiV5.get(`/resources?${qs.stringify(params)}`) .then(checkErrorV5).then(res => res.result); + /* API will return all roles to currentUser, so need to filter in FE */ + registrants = _.filter(registrants, r => r.roleId === roleId); + return registrants || []; } From 2249d45c2a468fe308ec238019cd685ad6b47c45 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Wed, 5 Aug 2020 09:33:18 +0530 Subject: [PATCH 095/144] fix: for #4700 https://github.com/topcoder-platform/community-app/issues/4700 luiz https://github.com/topcoder-platform/topcoder-react-lib/pull/215 1000.19.40 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 59ec031f..605ac7a7 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.19.39", + "version": "1000.19.40", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 2e8a30944a5f2b991b24434a02a7d26397a4ae6b Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Wed, 5 Aug 2020 10:02:23 +0530 Subject: [PATCH 096/144] fix: for #4672 https://github.com/topcoder-platform/community-app/issues/4672 luiz https://github.com/topcoder-platform/topcoder-react-lib/pull/214 1000.19.41 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 605ac7a7..d37edacf 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.19.40", + "version": "1000.19.41", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 9fec28b758f88afebf8aa543aba09514328685df Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Wed, 5 Aug 2020 16:36:46 -0300 Subject: [PATCH 097/144] Added QA to filter --- __tests__/__snapshots__/index.js.snap | 1 + src/utils/challenge/filter.js | 9 +++++++-- src/utils/tc.js | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index f1c7c70a..74951666 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -375,6 +375,7 @@ Object { "DATA_SCIENCE": "data_science", "DESIGN": "design", "DEVELOP": "develop", + "QA": "qa", }, "REVIEW_OPPORTUNITY_TYPES": Object { "Contest Review": "Review", diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index d9e6429e..ff0c672e 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -160,13 +160,18 @@ function filterByText(challenge, state) { function filterByTrack(challenge, state) { if (!state.tracks) return true; - /* Development challenges having Data Science tech tag, still should be - * included into data science track. */ + /* Development challenges having Data Science and QA tech tag, still should be + * included into data science and qa tracks. */ if (state.tracks[COMPETITION_TRACKS.DATA_SCIENCE] && _.includes(challenge.tags, 'Data Science')) { return true; } + if (state.tracks[COMPETITION_TRACKS.QA] + && _.includes(challenge.tags, 'QA')) { + return true; + } + return _.keys(state.tracks).some(track => challenge.communities.has(track)); } diff --git a/src/utils/tc.js b/src/utils/tc.js index aed187ca..4cbf115e 100644 --- a/src/utils/tc.js +++ b/src/utils/tc.js @@ -14,6 +14,7 @@ export const COMPETITION_TRACKS = { DATA_SCIENCE: 'data_science', DESIGN: 'design', DEVELOP: 'develop', + QA: 'qa', }; /** From b58fd0cfc2df2fa751e6dd031d9bf38f0fa24055 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Wed, 5 Aug 2020 20:34:58 -0300 Subject: [PATCH 098/144] Updated challengeSubtracks to challengeTypes in filter --- __tests__/__snapshots__/index.js.snap | 2 +- __tests__/utils/challenge/filter.js | 12 +++++------ docs/challenge.filter.md | 10 ++++----- src/utils/challenge/filter.js | 29 +++++++++++++-------------- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index 74951666..8206f48c 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -225,9 +225,9 @@ Object { "setEndDate": [Function], "setReviewOpportunityType": [Function], "setStartDate": [Function], - "setSubtracks": [Function], "setTags": [Function], "setText": [Function], + "setTypes": [Function], }, }, "errors": Object { diff --git a/__tests__/utils/challenge/filter.js b/__tests__/utils/challenge/filter.js index 950a1ca9..01a4753b 100644 --- a/__tests__/utils/challenge/filter.js +++ b/__tests__/utils/challenge/filter.js @@ -1,5 +1,5 @@ import { - setText, setTags, setSubtracks, setStartDate, + setText, setTags, setTypes, setStartDate, } from '../../../src/utils/challenge/filter'; describe('challenge filter', () => { @@ -22,12 +22,12 @@ describe('challenge filter', () => { expect(res).toEqual({}); }); - test('setSubtracks', () => { - res = setSubtracks({}); + test('setTypes', () => { + res = setTypes({}); expect(res).toEqual({}); - res = setSubtracks({}, 'subtracks'); - expect(res).toEqual({ subtracks: 'subtracks' }); - res = setSubtracks({ subtracks: 'subtracks' }); + res = setTypes({}, 'types'); + expect(res).toEqual({ types: 'types' }); + res = setTypes({ types: 'types' }); expect(res).toEqual({}); }); diff --git a/docs/challenge.filter.md b/docs/challenge.filter.md index 978050ee..391ef5e5 100644 --- a/docs/challenge.filter.md +++ b/docs/challenge.filter.md @@ -70,7 +70,7 @@ users are participating. * [.setEndDate(state, date)](#module_challenge.filter.setEndDate) ⇒ <code>Object</code> * [.setReviewOpportunityType(state, reviewOpportunityType)](#module_challenge.filter.setReviewOpportunityType) ⇒ <code>Object</code> * [.setStartDate(state, date)](#module_challenge.filter.setStartDate) ⇒ <code>Object</code> - * [.setSubtracks(state, subtracks)](#module_challenge.filter.setSubtracks) ⇒ <code>Object</code> + * [.setTypes(state, types)](#module_challenge.filter.setTypes) ⇒ <code>Object</code> * [.setTags(state, tags)](#module_challenge.filter.setTags) ⇒ <code>Object</code> * [.setText(state, text)](#module_challenge.filter.setText) ⇒ <code>Object</code> * _inner_ @@ -198,17 +198,17 @@ Clones the state and sets the start date. | state | <code>Object</code> | | | date | <code>String</code> | ISO date string. | -<a name="module_challenge.filter.setSubtracks"></a> +<a name="module_challenge.filter.setTypes"></a> -### challenge.filter.setSubtracks(state, subtracks) ⇒ <code>Object</code> -Clones the state and sets the subtracks. +### challenge.filter.setTypes(state, types) ⇒ <code>Object</code> +Clones the state and sets the challenge types. **Kind**: static method of [<code>challenge.filter</code>](#module_challenge.filter) | Param | Type | | --- | --- | | state | <code>Object</code> | -| subtracks | <code>Array</code> | +| types | <code>Array</code> | <a name="module_challenge.filter.setTags"></a> diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index ff0c672e..778a6595 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -175,9 +175,9 @@ function filterByTrack(challenge, state) { return _.keys(state.tracks).some(track => challenge.communities.has(track)); } -function filterBySubtracks(challenge, state) { - if (!state.subtracks) return true; - return state.subtracks.includes(challenge.typeId); +function filterByTypes(challenge, state) { + if (!state.types) return true; + return state.types.includes(challenge.typeId); } function filterByUpcoming(challenge, state) { @@ -227,7 +227,7 @@ export function getFilterFunction(state) { && filterByGroupIds(challenge, state) && filterByText(challenge, state) && filterByTags(challenge, state) - && filterBySubtracks(challenge, state) + && filterByTypes(challenge, state) && filterByUsers(challenge, state) && filterByEndDate(challenge, state) && filterByStartDate(challenge, state) @@ -250,9 +250,9 @@ export function getFilterFunction(state) { * @param {Object} state * @return {Function} */ -export function getReviewOpportunitiesFilterFunction(state, validSubtracks) { +export function getReviewOpportunitiesFilterFunction(state, validTypes) { return (opp) => { - const newSubTrack = _.find(validSubtracks, { abbreviation: opp.challenge.subTrack }) || {}; + const newType = _.find(validTypes, { name: opp.challenge.type }) || {}; // Review Opportunity objects have a challenge field which // is largely compatible with many of the existing filter functions @@ -262,12 +262,11 @@ export function getReviewOpportunitiesFilterFunction(state, validSubtracks) { // This allows filterByText to search for Review Types and Challenge Titles name: `${opp.challenge.title} ${REVIEW_OPPORTUNITY_TYPES[opp.type]}`, registrationStartDate: opp.startDate, // startDate of Review, not Challenge - subTrack: opp.challenge.subTrack || '', // Sometimes back-end doesn't return this field submissionEndDate: opp.startDate, // Currently uses startDate for both date comparisons communities: new Set([ // Used to filter by Track, and communities at a future date opp.challenge.track.toLowerCase(), ]), - typeId: newSubTrack.id, + typeId: newType.id, tags: opp.challenge.technologies || [], platforms: opp.challenge.platforms || [], }; @@ -276,7 +275,7 @@ export function getReviewOpportunitiesFilterFunction(state, validSubtracks) { filterByTrack(challenge, state) && filterByText(challenge, state) && filterByTags(challenge, state) - && filterBySubtracks(challenge, state) + && filterByTypes(challenge, state) && filterByEndDate(challenge, state) && filterByStartDate(challenge, state) && filterByReviewOpportunityType(opp, state) @@ -460,16 +459,16 @@ export function setStartDate(state, date) { } /** - * Clones the state and sets the subtracks. + * Clones the state and sets the challenge types. * @param {Object} state - * @param {Array} subtracks + * @param {Array} types * @return {Object} */ -export function setSubtracks(state, subtracks) { - if (subtracks && subtracks.length) return { ...state, subtracks }; - if (!state.subtracks) return state; +export function setTypes(state, types) { + if (types && types.length) return { ...state, types }; + if (!state.types) return state; const res = _.clone(state); - delete res.subtracks; + delete res.types; return res; } From d16b2ba0ff0feb1aa015ebbe2f1449e0a9cc744b Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Thu, 6 Aug 2020 00:06:00 -0300 Subject: [PATCH 099/144] Update to use new challenge.track name + added QA --- __tests__/__snapshots__/index.js.snap | 8 ++++---- src/utils/challenge/filter.js | 15 +-------------- src/utils/tc.js | 8 ++++---- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index 8206f48c..53d2317a 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -372,10 +372,10 @@ Object { }, "tc": Object { "COMPETITION_TRACKS": Object { - "DATA_SCIENCE": "data_science", - "DESIGN": "design", - "DEVELOP": "develop", - "QA": "qa", + "DATA_SCIENCE": "Data Science", + "DESIGN": "Design", + "DEVELOP": "Development", + "QA": "Quality Assurance", }, "REVIEW_OPPORTUNITY_TYPES": Object { "Contest Review": "Review", diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 778a6595..e7aebf8d 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -159,20 +159,7 @@ function filterByText(challenge, state) { function filterByTrack(challenge, state) { if (!state.tracks) return true; - - /* Development challenges having Data Science and QA tech tag, still should be - * included into data science and qa tracks. */ - if (state.tracks[COMPETITION_TRACKS.DATA_SCIENCE] - && _.includes(challenge.tags, 'Data Science')) { - return true; - } - - if (state.tracks[COMPETITION_TRACKS.QA] - && _.includes(challenge.tags, 'QA')) { - return true; - } - - return _.keys(state.tracks).some(track => challenge.communities.has(track)); + return _.keys(state.tracks).some(track => challenge.track === track); } function filterByTypes(challenge, state) { diff --git a/src/utils/tc.js b/src/utils/tc.js index 4cbf115e..5388d4bb 100644 --- a/src/utils/tc.js +++ b/src/utils/tc.js @@ -11,10 +11,10 @@ * uses upper-case literals to encode the tracks. At some point, we should * update it in this code as well! */ export const COMPETITION_TRACKS = { - DATA_SCIENCE: 'data_science', - DESIGN: 'design', - DEVELOP: 'develop', - QA: 'qa', + DATA_SCIENCE: 'Data Science', + DESIGN: 'Design', + DEVELOP: 'Development', + QA: 'Quality Assurance', }; /** From 8bf92d9d8a110f0b9cd7fc8a853fc313a2cd7268 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Thu, 6 Aug 2020 12:55:19 +0530 Subject: [PATCH 100/144] fix: for #4706 https://github.com/topcoder-platform/community-app/issues/4706 luiz https://github.com/topcoder-platform/community-app/pull/4711 https://github.com/topcoder-platform/topcoder-react-lib/pull/216 1000.19.42 https://github.com/topcoder-platform/topcoder-react-ui-kit/pull/27 1000.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d37edacf..4dd943eb 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.19.41", + "version": "1000.19.42", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From ab871c458419d83e4f090a434fee135e15e63559 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Mon, 10 Aug 2020 00:01:43 -0300 Subject: [PATCH 101/144] Updated legacy with challenge.type and challenge.track --- src/services/challenges.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 05b8cad6..f24bdf5e 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -53,11 +53,6 @@ export function normalizeChallenge(challenge, username) { if (!challenge.tags) challenge.tags = []; if (!challenge.platforms) challenge.platforms = []; - if (challenge.type === 'Marathon Match') { - challenge.legacy.track = 'DATA_SCIENCE'; - } - /* eslint-enable no-param-reassign */ - let submissionEndTimestamp = phases.filter(d => d.name === 'Submission')[0]; if (submissionEndTimestamp) { submissionEndTimestamp = submissionEndTimestamp.scheduledEndDate; @@ -539,15 +534,9 @@ class ChallengesService { * @return {Promise} Resolves to the api response. */ async getUserMarathonMatches(memberId, params) { - const typeId = await this.getChallengeTypeId('DEVELOP_MARATHON_MATCH'); - - if (!typeId) { - return null; - } - const newParams = { ...params, - typeId, + tag: 'Marathon Match', memberId, }; From 7ff38a87fa9f7a7d2d82bbd7961d686519e5e13a Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Mon, 10 Aug 2020 12:44:46 +0530 Subject: [PATCH 102/144] fix: for #4709 https://github.com/topcoder-platform/community-app/issues/4709 luiz https://github.com/topcoder-platform/community-app/pull/4728 https://github.com/topcoder-platform/topcoder-react-lib/pull/217 1000.19.43 https://github.com/topcoder-platform/topcoder-react-ui-kit/pull/29 1000.0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4dd943eb..63c2c4fe 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.19.42", + "version": "1000.19.43", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From e272c326d514480717d2cfd43e0bfac385e2e20a Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 11 Aug 2020 07:05:39 -0300 Subject: [PATCH 103/144] Disable filter by Type in getReviewOpportunitiesFilterFunction --- src/utils/challenge/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index e7aebf8d..36e91e6f 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -262,7 +262,7 @@ export function getReviewOpportunitiesFilterFunction(state, validTypes) { filterByTrack(challenge, state) && filterByText(challenge, state) && filterByTags(challenge, state) - && filterByTypes(challenge, state) + // && filterByTypes(challenge, state) && filterByEndDate(challenge, state) && filterByStartDate(challenge, state) && filterByReviewOpportunityType(opp, state) From 69feceacf4ee3c8813c241ae84aaed53f657b740 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Tue, 11 Aug 2020 16:07:24 +0530 Subject: [PATCH 104/144] fix: for #4718 https://github.com/topcoder-platform/community-app/issues/4718 luiz https://github.com/topcoder-platform/community-app/pull/4738 https://github.com/topcoder-platform/topcoder-react-lib/pull/218 1000.19.44 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 63c2c4fe..6559a5cf 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.19.43", + "version": "1000.19.44", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From e7ee6d0b4473aa50149126a206dc4900d3025833 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 11 Aug 2020 17:17:06 -0300 Subject: [PATCH 105/144] Fix Open For Review changes filter --- src/services/reviewOpportunities.js | 30 ++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/services/reviewOpportunities.js b/src/services/reviewOpportunities.js index 51af9e44..820f5a46 100644 --- a/src/services/reviewOpportunities.js +++ b/src/services/reviewOpportunities.js @@ -8,19 +8,31 @@ import { getApi } from './api'; /** * Sync the fields of V3 and V5 for front-end to process successfully - * @param challenges - challenges to normalize + * @param opportunities - opportunities to normalize */ -export function normalizeChallenges(challenges) { - if (challenges) { - _.map(challenges, (ch) => { - const { challenge } = ch; - if (challenge.technologies && challenge.technologies.includes('Data Science')) { - challenge.track = 'DATA_SCIENCE'; +export function normalizeChallenges(opportunities) { + if (opportunities) { + /* Issue#4739 : Temporary add track to review opportunities challenges + * until receive API V5 update. */ + _.map(opportunities, (opportunity) => { + const { challenge } = opportunity; + challenge.track = 'Development'; + if (challenge.technologies) { + if (challenge.technologies.includes('Data Science')) { + challenge.track = 'Data Science'; + } else if (challenge.technologies.includes('QA')) { + challenge.track = 'Quality Assurance'; + } + } else if (challenge.subTrack === 'TEST_SUITES' || challenge.subTrack === 'BUG_HUNT') { + challenge.track = 'Quality Assurance'; + } else if (challenge.track === 'DESIGN') { + challenge.track = 'Design'; } - return _.defaults(ch, { challenge }); + return _.defaults(opportunity, { challenge }); }); } - return challenges; + + return opportunities; } /** From b07363e003fd059c2a6af3d188439ae5c2e8aee0 Mon Sep 17 00:00:00 2001 From: Cagdas U <cagdasugurlu01@gmail.com> Date: Wed, 12 Aug 2020 08:09:32 +0300 Subject: [PATCH 106/144] fix(members-service): fetch only active challenges At the `getUserResources` function, it will fetch only Active challenges. Reference topcoder-platform/community-app#4714 --- src/services/members.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/services/members.js b/src/services/members.js index 7716c91d..a5b32a51 100644 --- a/src/services/members.js +++ b/src/services/members.js @@ -7,6 +7,7 @@ /* global XMLHttpRequest */ import _ from 'lodash'; import qs from 'qs'; +import { decodeToken } from 'tc-accounts'; import logger from '../utils/logger'; import { getApiResponsePayload } from '../utils/tc'; import { getApi } from './api'; @@ -329,7 +330,8 @@ class MembersService { * @param {Array} challengeId the challenge id */ async getChallengeResources(challengeId) { - const url = `/resources?challengeId=${challengeId}`; + const user = decodeToken(this.private.tokenV3); + const url = `/resources?challengeId=${challengeId}&memberId=${user.userId}`; let res = null; try { @@ -346,14 +348,14 @@ class MembersService { * @param {Array} memberId the member id */ async getUserResources(memberId) { - const url = `/resources/${memberId}/challenges`; + const url = `/challenges?status=Active&memberId=${memberId}`; const res = await this.private.apiV5.get(url); const challenges = await res.json(); const roles = await this.getResourceRoles(); const calls = []; challenges.forEach(async (ch) => { - calls.push(this.getChallengeResources(ch)); + calls.push(this.getChallengeResources(ch.id)); }); return Promise.all(calls).then((resources) => { From 1f69bae40442df8a6b7b564d6de403c523241151 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Thu, 13 Aug 2020 15:17:50 +0530 Subject: [PATCH 107/144] fix: for #4714 https://github.com/topcoder-platform/community-app/issues/4714 cagdas001 https://github.com/topcoder-platform/topcoder-react-lib/pull/220 1000.19.45 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6559a5cf..16989194 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.19.44", + "version": "1000.19.45", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 7cca2afb54e725f0b1f7f29afdb138aa8cdccc1c Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Thu, 13 Aug 2020 21:44:51 -0300 Subject: [PATCH 108/144] Fix challenge.track validation --- src/reducers/challenge.js | 4 +++- src/services/challenges.js | 4 ++-- src/utils/challenge/filter.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/reducers/challenge.js b/src/reducers/challenge.js index 05bb9bc9..e91c4f53 100644 --- a/src/reducers/challenge.js +++ b/src/reducers/challenge.js @@ -18,6 +18,8 @@ import { fireErrorMessage } from '../utils/errors'; import mySubmissionsManagement from './my-submissions-management'; +import { COMPETITION_TRACKS } from '../utils/tc'; + /** * Handles CHALLENGE/GET_DETAILS_INIT action. * @param {Object} state @@ -469,7 +471,7 @@ export function factory(options = {}) { const challengeDetails = _.get(res, 'payload', {}); const track = _.get(challengeDetails, 'legacy.track', ''); let checkpointsPromise = null; - if (track === 'DESIGN') { + if (track === COMPETITION_TRACKS.DESIGN) { const p = _.get(challengeDetails, 'phases', []) .filter(x => x.name === 'Checkpoint Review'); if (p.length && !p[0].isOpen) { diff --git a/src/services/challenges.js b/src/services/challenges.js index f24bdf5e..d5fb3bc2 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -636,7 +636,7 @@ class ChallengesService { let contentType; let url; - if (track === 'DESIGN') { + if (track === COMPETITION_TRACKS.DESIGN) { ({ api } = this.private); contentType = 'application/json'; url = '/submissions/'; // The submission info is contained entirely in the JSON body @@ -654,7 +654,7 @@ class ChallengesService { }, onProgress).then((res) => { const jres = JSON.parse(res); // Return result for Develop submission - if (track === 'DEVELOP') { + if (track === COMPETITION_TRACKS.DEVELOP) { return jres; } // Design Submission requires an extra "Processing" POST diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 36e91e6f..263c3132 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -89,7 +89,7 @@ function filterByRegistrationOpen(challenge, state) { if (!registrationPhase || !registrationPhase.isOpen) { return false; } - if (challenge.track === 'DESIGN') { + if (challenge.track === COMPETITION_TRACKS.DESIGN) { const checkpointPhase = challengePhases.find(item => item.name === 'Checkpoint Submission')[0]; return !checkpointPhase || !checkpointPhase.isOpen; } From 0a44b2e2ffde93327b99b8c25e0d9093016535fb Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Thu, 13 Aug 2020 21:44:51 -0300 Subject: [PATCH 109/144] Fix challenge.track validation --- src/reducers/challenge.js | 4 +++- src/services/challenges.js | 4 ++-- src/utils/challenge/filter.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/reducers/challenge.js b/src/reducers/challenge.js index 05bb9bc9..e91c4f53 100644 --- a/src/reducers/challenge.js +++ b/src/reducers/challenge.js @@ -18,6 +18,8 @@ import { fireErrorMessage } from '../utils/errors'; import mySubmissionsManagement from './my-submissions-management'; +import { COMPETITION_TRACKS } from '../utils/tc'; + /** * Handles CHALLENGE/GET_DETAILS_INIT action. * @param {Object} state @@ -469,7 +471,7 @@ export function factory(options = {}) { const challengeDetails = _.get(res, 'payload', {}); const track = _.get(challengeDetails, 'legacy.track', ''); let checkpointsPromise = null; - if (track === 'DESIGN') { + if (track === COMPETITION_TRACKS.DESIGN) { const p = _.get(challengeDetails, 'phases', []) .filter(x => x.name === 'Checkpoint Review'); if (p.length && !p[0].isOpen) { diff --git a/src/services/challenges.js b/src/services/challenges.js index f24bdf5e..d5fb3bc2 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -636,7 +636,7 @@ class ChallengesService { let contentType; let url; - if (track === 'DESIGN') { + if (track === COMPETITION_TRACKS.DESIGN) { ({ api } = this.private); contentType = 'application/json'; url = '/submissions/'; // The submission info is contained entirely in the JSON body @@ -654,7 +654,7 @@ class ChallengesService { }, onProgress).then((res) => { const jres = JSON.parse(res); // Return result for Develop submission - if (track === 'DEVELOP') { + if (track === COMPETITION_TRACKS.DEVELOP) { return jres; } // Design Submission requires an extra "Processing" POST diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 36e91e6f..263c3132 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -89,7 +89,7 @@ function filterByRegistrationOpen(challenge, state) { if (!registrationPhase || !registrationPhase.isOpen) { return false; } - if (challenge.track === 'DESIGN') { + if (challenge.track === COMPETITION_TRACKS.DESIGN) { const checkpointPhase = challengePhases.find(item => item.name === 'Checkpoint Submission')[0]; return !checkpointPhase || !checkpointPhase.isOpen; } From d5ba25f0999d1c673ea44f43cca97507236d29e0 Mon Sep 17 00:00:00 2001 From: Unknown <mtwomey@beakstar.com> Date: Thu, 13 Aug 2020 23:06:11 -0500 Subject: [PATCH 110/144] fix: for #4749 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6559a5cf..31d4b3a4 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.19.44", + "version": "1000.19.46", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From f39c0120820db39cc259ab27c48e454281921c87 Mon Sep 17 00:00:00 2001 From: Unknown <mtwomey@beakstar.com> Date: Fri, 14 Aug 2020 00:20:28 -0500 Subject: [PATCH 111/144] Fix getChallengeRegistrants filter to not logged user Also update to version 100.19.47 --- package.json | 2 +- src/services/challenges.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 31d4b3a4..d8b4e042 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.19.46", + "version": "1000.19.47", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", diff --git a/src/services/challenges.js b/src/services/challenges.js index d5fb3bc2..d0a298ae 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -407,7 +407,9 @@ class ChallengesService { .then(checkErrorV5).then(res => res.result); /* API will return all roles to currentUser, so need to filter in FE */ - registrants = _.filter(registrants, r => r.roleId === roleId); + if (roleId) { + registrants = _.filter(registrants, r => r.roleId === roleId); + } return registrants || []; } From cebfd8b2f3afb9dd21c99ec4900145a9496637be Mon Sep 17 00:00:00 2001 From: Unknown <mtwomey@beakstar.com> Date: Sat, 15 Aug 2020 23:55:37 -0500 Subject: [PATCH 112/144] Hotfix - Remove old legacy.track Also update version to 1000.19.48 --- package.json | 2 +- src/reducers/challenge.js | 2 +- src/services/challenges.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d8b4e042..688904c8 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.19.47", + "version": "1000.19.48", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", diff --git a/src/reducers/challenge.js b/src/reducers/challenge.js index e91c4f53..7fb1dbd9 100644 --- a/src/reducers/challenge.js +++ b/src/reducers/challenge.js @@ -469,7 +469,7 @@ export function factory(options = {}) { tokens.tokenV2, )).then((res) => { const challengeDetails = _.get(res, 'payload', {}); - const track = _.get(challengeDetails, 'legacy.track', ''); + const track = _.get(challengeDetails, 'track', ''); let checkpointsPromise = null; if (track === COMPETITION_TRACKS.DESIGN) { const p = _.get(challengeDetails, 'phases', []) diff --git a/src/services/challenges.js b/src/services/challenges.js index d0a298ae..fd0fecec 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -59,7 +59,7 @@ export function normalizeChallenge(challenge, username) { } const prizes = (challenge.prizeSets[0] && challenge.prizeSets[0].prizes) || []; _.defaults(challenge, { - communities: new Set([COMPETITION_TRACKS[challenge.legacy.track]]), + communities: new Set([COMPETITION_TRACKS[challenge.track]]), groups, registrationOpen, submissionEndTimestamp, From 50baf8afc2f147d3e7071b3bd8abfc3c14fcb6fb Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Tue, 18 Aug 2020 11:40:39 +0530 Subject: [PATCH 113/144] ci: sync with integration develop --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 688904c8..cb438fa8 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.19.48", + "version": "1000.19.50", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From f81a30299a3dff2ea7b970aca3e7b7da2cc3dcaa Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Tue, 18 Aug 2020 11:54:47 +0530 Subject: [PATCH 114/144] ci: sync with develop --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cb438fa8..35c82bc4 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.19.50", + "version": "1000.19.51", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 100dcb704935ed44711805e0d4204ddb7e15f82c Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Tue, 18 Aug 2020 18:06:55 +0530 Subject: [PATCH 115/144] feat: v5 API integration --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 688904c8..e9654cb9 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.19.48", + "version": "1.0.0", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 4ee089d9ad8b9dfa84793bd2b36170eb7fa5d0da Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Tue, 18 Aug 2020 18:07:37 +0530 Subject: [PATCH 116/144] ci: removed dist tag --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e8eac28e..0e161844 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 --tag test-release + - run: npm publish # dont change anything workflows: version: 2 From cf892ffa37ffc7a8ff93c8ac9e0064b1bd3dc331 Mon Sep 17 00:00:00 2001 From: Cagdas U <cagdasugurlu01@gmail.com> Date: Sun, 23 Aug 2020 23:26:13 +0300 Subject: [PATCH 117/144] fix(challenge-utils): update `filterByUsers` to use `userId` Update `filterByUsers` function to use `challenge.users[userId]` property instead of `userChallenges` for filtering. Addresses topcoder-platform/community-app#4782 --- src/utils/challenge/filter.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 263c3132..d662a230 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -173,8 +173,11 @@ function filterByUpcoming(challenge, state) { } function filterByUsers(challenge, state) { - if (!state.userChallenges) return true; - return state.userChallenges.find(ch => challenge.id === ch); + const userId = _.get(state, 'userId', null); + if (userId) { + return _.get(challenge, ['users', userId], false); + } + return true; } /** From a1ad2ee059f5cc7295b1605146ee1de725a23c17 Mon Sep 17 00:00:00 2001 From: PrakashDurlabhji <prakashseta@gmail.com> Date: Tue, 25 Aug 2020 04:46:39 +0530 Subject: [PATCH 118/144] Update challenges.js --- src/services/challenges.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index fd0fecec..5f497304 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -328,7 +328,7 @@ class ChallengesService { if (/^[\d]{5,8}$/.test(challengeId)) { isLegacyChallenge = true; challenge = await this.private.getChallenges('/challenges/', { legacyId: challengeId }) - .then(res => res.challenges[0]); + .then(res => res.challenges); } else { challenge = await this.private.getChallenges(`/challenges/${challengeId}`) .then(res => res.challenges); From 65212c645f8d8efcd73721a18280ca393370443b Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 25 Aug 2020 02:01:33 -0300 Subject: [PATCH 119/144] Fix groupIds filter --- src/utils/challenge/filter.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 263c3132..31c28c5c 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -71,8 +71,9 @@ import { COMPETITION_TRACKS, REVIEW_OPPORTUNITY_TYPES } from '../tc'; */ function filterByGroupIds(challenge, state) { - if (!state.groupIds) return true; - return state.groupIds.some(id => challenge.groups[id]); + if (_.isEmpty(state.groupIds)) return true; + if (_.isEmpty(challenge.groups)) return false; + return state.groupIds.some(id => challenge.groups.find(gId => gId === id)); } function filterByRegistrationOpen(challenge, state) { @@ -343,7 +344,7 @@ export function combine(...filters) { const res = {}; filters.forEach((filter) => { combineEndDate(res, filter); - combineArrayRules(res, filter, 'groups'); + combineArrayRules(res, filter, 'groupIds'); /* TODO: The registrationOpen rule is just ignored for now. */ combineStartDate(res, filter); combineArrayRules(res, filter, 'or', true); @@ -380,7 +381,7 @@ export function combine(...filters) { */ export function mapToBackend(filter) { const res = {}; - if (filter.groups) res.groups = filter.groups; + if (filter.groupIds) res.groups = filter.groupIds; return res; } From a8862cc1dfb132e8444f2df9f647070d71de1f0f Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 25 Aug 2020 02:02:04 -0300 Subject: [PATCH 120/144] Added filterByEvents to TCO filter --- src/utils/challenge/filter.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 31c28c5c..e37974c4 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -151,6 +151,12 @@ function filterByTags(challenge, state) { return state.tags.some(tag => str.includes(tag.toLowerCase())); } +function filterByEvents(challenge, state) { + if (_.isEmpty(state.events)) return true; + if (_.isEmpty(challenge.events)) return false; + return state.events.some(key => challenge.events.find(e => e.key === key )); +} + function filterByText(challenge, state) { if (!state.text) return true; const str = `${challenge.name} ${challenge.tags} ${challenge.platforms} ${challenge.tags}` @@ -215,6 +221,7 @@ export function getFilterFunction(state) { && filterByGroupIds(challenge, state) && filterByText(challenge, state) && filterByTags(challenge, state) + && filterByEvents(challenge, state) && filterByTypes(challenge, state) && filterByUsers(challenge, state) && filterByEndDate(challenge, state) From 0b002e812d1af3b42b1d0dd66cb80052b6c8bca1 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 25 Aug 2020 02:19:17 -0300 Subject: [PATCH 121/144] Fix filterByTags check if isEmpty --- src/utils/challenge/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index e37974c4..331daf99 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -145,7 +145,7 @@ function filterByStatus(challenge, state) { } function filterByTags(challenge, state) { - if (!state.tags) return true; + if (_.isEmpty(state.tags)) return true; const { platforms, tags } = challenge; const str = `${platforms} ${tags}`.toLowerCase(); return state.tags.some(tag => str.includes(tag.toLowerCase())); From 4bc24f2e18da6ed90ba49d044d9a3d212fdb9afa Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 25 Aug 2020 03:04:02 -0300 Subject: [PATCH 122/144] Fix test --- src/utils/challenge/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 331daf99..117e0609 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -154,7 +154,7 @@ function filterByTags(challenge, state) { function filterByEvents(challenge, state) { if (_.isEmpty(state.events)) return true; if (_.isEmpty(challenge.events)) return false; - return state.events.some(key => challenge.events.find(e => e.key === key )); + return state.events.some(key => challenge.events.find(e => e.key === key)); } function filterByText(challenge, state) { From 477ccfebf66abec94167af297b44f1c6a9905d06 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Tue, 25 Aug 2020 05:03:04 -0300 Subject: [PATCH 123/144] Remove hard code tracks and subtracks --- __tests__/__snapshots__/index.js.snap | 10 ++++++++++ src/services/reviewOpportunities.js | 20 +++++++++++--------- src/utils/tc.js | 12 ++++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index 53d2317a..bf72ddb8 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -377,6 +377,16 @@ Object { "DEVELOP": "Development", "QA": "Quality Assurance", }, + "OLD_COMPETITION_TRACKS": Object { + "DATA_SCIENCE": "DATA_SCIENCE", + "DESIGN": "DESIGN", + "DEVELOP": "DEVELOP", + "QA": "QA", + }, + "OLD_SUBTRACKS": Object { + "BUG_HUNT": "BUG_HUNT", + "TEST_SUITES": "TEST_SUITES", + }, "REVIEW_OPPORTUNITY_TYPES": Object { "Contest Review": "Review", "Iterative Review": "Iterative Review", diff --git a/src/services/reviewOpportunities.js b/src/services/reviewOpportunities.js index 820f5a46..87f8dcd3 100644 --- a/src/services/reviewOpportunities.js +++ b/src/services/reviewOpportunities.js @@ -4,6 +4,7 @@ * submitting applications. */ import _ from 'lodash'; +import { COMPETITION_TRACKS, OLD_COMPETITION_TRACKS, OLD_SUBTRACKS } from 'utils/tc'; import { getApi } from './api'; /** @@ -16,17 +17,18 @@ export function normalizeChallenges(opportunities) { * until receive API V5 update. */ _.map(opportunities, (opportunity) => { const { challenge } = opportunity; - challenge.track = 'Development'; + challenge.track = COMPETITION_TRACKS.DEVELOP; if (challenge.technologies) { - if (challenge.technologies.includes('Data Science')) { - challenge.track = 'Data Science'; - } else if (challenge.technologies.includes('QA')) { - challenge.track = 'Quality Assurance'; + if (challenge.technologies.includes(COMPETITION_TRACKS.DATA_SCIENCE)) { + challenge.track = COMPETITION_TRACKS.DATA_SCIENCE; + } else if (challenge.technologies.includes(OLD_COMPETITION_TRACKS.QA)) { + challenge.track = COMPETITION_TRACKS.QA; } - } else if (challenge.subTrack === 'TEST_SUITES' || challenge.subTrack === 'BUG_HUNT') { - challenge.track = 'Quality Assurance'; - } else if (challenge.track === 'DESIGN') { - challenge.track = 'Design'; + } else if (challenge.subTrack === OLD_SUBTRACKS.TEST_SUITES + || challenge.subTrack === OLD_SUBTRACKS.BUG_HUNT) { + challenge.track = COMPETITION_TRACKS.QA; + } else if (challenge.track === OLD_COMPETITION_TRACKS.DESIGN) { + challenge.track = COMPETITION_TRACKS.DESIGN; } return _.defaults(opportunity, { challenge }); }); diff --git a/src/utils/tc.js b/src/utils/tc.js index 5388d4bb..28bcf3b2 100644 --- a/src/utils/tc.js +++ b/src/utils/tc.js @@ -17,6 +17,18 @@ export const COMPETITION_TRACKS = { QA: 'Quality Assurance', }; +export const OLD_COMPETITION_TRACKS = { + DATA_SCIENCE: 'DATA_SCIENCE', + DESIGN: 'DESIGN', + DEVELOP: 'DEVELOP', + QA: 'QA', +}; + +export const OLD_SUBTRACKS = { + TEST_SUITES: 'TEST_SUITES', + BUG_HUNT: 'BUG_HUNT', +}; + /** * Review Opportunity types */ From c34961cf758b63c1d0cd87b00634a05262a534c7 Mon Sep 17 00:00:00 2001 From: Cagdas U <cagdasugurlu01@gmail.com> Date: Sun, 23 Aug 2020 23:26:13 +0300 Subject: [PATCH 124/144] fix(challenge-utils): update `filterByUsers` to use `userId` Update `filterByUsers` function to use `challenge.users[userId]` property instead of `userChallenges` for filtering. Addresses topcoder-platform/community-app#4782 --- src/utils/challenge/filter.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 263c3132..d662a230 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -173,8 +173,11 @@ function filterByUpcoming(challenge, state) { } function filterByUsers(challenge, state) { - if (!state.userChallenges) return true; - return state.userChallenges.find(ch => challenge.id === ch); + const userId = _.get(state, 'userId', null); + if (userId) { + return _.get(challenge, ['users', userId], false); + } + return true; } /** From 394020b2312fe98facb7c51cf3a3de18c3156845 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Tue, 25 Aug 2020 14:10:03 +0530 Subject: [PATCH 125/144] fix: for #4782 https://github.com/topcoder-platform/community-app/issues/4782 cagdas001 https://github.com/topcoder-platform/community-app/pull/4801 https://github.com/topcoder-platform/topcoder-react-lib/pull/228 1000.20.0 --- .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 4b5f5f3a0d89cc3bb6130e5c7d6e8899ce5f8c93 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Tue, 25 Aug 2020 14:11:45 +0530 Subject: [PATCH 126/144] fix: for #4782 https://github.com/topcoder-platform/community-app/issues/4782 cagdas001 https://github.com/topcoder-platform/community-app/pull/4801 https://github.com/topcoder-platform/topcoder-react-lib/pull/228 1000.20.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e9654cb9..f5e94194 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.0.0", + "version": "1000.20.0", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 5367d032435fecc62944a5ec50b7f2cc38fa6477 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Thu, 27 Aug 2020 16:12:11 +0530 Subject: [PATCH 127/144] fix: for #4739 https://github.com/topcoder-platform/community-app/issues/4739 luiz https://github.com/topcoder-platform/community-app/pull/4742 https://github.com/topcoder-platform/topcoder-react-lib/pull/219 1000.20.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5e94194..857382d3 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.20.0", + "version": "1000.20.1", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 8fe8d9e170072b50e1bb47e98b0a7c8ed520b5bc Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Thu, 27 Aug 2020 16:15:45 +0530 Subject: [PATCH 128/144] fix: for #4739 https://github.com/topcoder-platform/community-app/issues/4739 luiz https://github.com/topcoder-platform/community-app/pull/4742 https://github.com/topcoder-platform/topcoder-react-lib/pull/219 1000.20.1 --- src/services/challenges.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index fd0fecec..5f497304 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -328,7 +328,7 @@ class ChallengesService { if (/^[\d]{5,8}$/.test(challengeId)) { isLegacyChallenge = true; challenge = await this.private.getChallenges('/challenges/', { legacyId: challengeId }) - .then(res => res.challenges[0]); + .then(res => res.challenges); } else { challenge = await this.private.getChallenges(`/challenges/${challengeId}`) .then(res => res.challenges); From c7656cf71d657b0fce174fb521a2e90ddf0d2d86 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Thu, 27 Aug 2020 17:44:20 +0530 Subject: [PATCH 129/144] fix: for #4575 https://github.com/topcoder-platform/community-app/issues/4575 luiz https://github.com/topcoder-platform/community-app/pull/4810 https://github.com/topcoder-platform/topcoder-react-lib/pull/231 1000.20.2 1000.20.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 857382d3..8086c298 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.20.1", + "version": "1000.20.3", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 02fd5ed93af70b1e1a05fa697452fa8282189f92 Mon Sep 17 00:00:00 2001 From: Cagdas U <cagdasugurlu01@gmail.com> Date: Thu, 27 Aug 2020 17:25:55 +0300 Subject: [PATCH 130/144] Revert "fix(challenge-utils): update `filterByUsers` to use `userId`" This reverts commit cf892ffa37ffc7a8ff93c8ac9e0064b1bd3dc331. --- src/utils/challenge/filter.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index d662a230..263c3132 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -173,11 +173,8 @@ function filterByUpcoming(challenge, state) { } function filterByUsers(challenge, state) { - const userId = _.get(state, 'userId', null); - if (userId) { - return _.get(challenge, ['users', userId], false); - } - return true; + if (!state.userChallenges) return true; + return state.userChallenges.find(ch => challenge.id === ch); } /** From 385538fd218ecf279ca6f1d2e598059e958f1821 Mon Sep 17 00:00:00 2001 From: Cagdas U <cagdasugurlu01@gmail.com> Date: Thu, 27 Aug 2020 19:00:53 +0300 Subject: [PATCH 131/144] fix: add `page` and `perPage` parameters in `getUserResources` --- src/services/challenges.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index fd0fecec..c90f9c9d 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -522,10 +522,12 @@ class ChallengesService { /** * Gets user resources. * @param {String} userId User id whose challenges we want to fetch. + * @param {Number} page Current page for paginated API response (default 1) + * @param {Number} perPage Page size for paginated API response (default 1000) * @return {Promise} Resolves to the api response. */ - async getUserResources(userId) { - const res = await this.private.apiV5.get(`/resources/${userId}/challenges`); + async getUserResources(userId, page = 1, perPage = 1000) { + const res = await this.private.apiV5.get(`/resources/${userId}/challenges?page=${page}&perPage=${perPage}`); return res.json(); } From 193bb43434d082ccf3a69265a592946cab256a45 Mon Sep 17 00:00:00 2001 From: PrakashDurlabhji <prakashseta@gmail.com> Date: Fri, 28 Aug 2020 16:51:29 +0530 Subject: [PATCH 132/144] Update challenges.js --- src/services/challenges.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/challenges.js b/src/services/challenges.js index 5f497304..475d2f69 100644 --- a/src/services/challenges.js +++ b/src/services/challenges.js @@ -328,7 +328,7 @@ class ChallengesService { if (/^[\d]{5,8}$/.test(challengeId)) { isLegacyChallenge = true; challenge = await this.private.getChallenges('/challenges/', { legacyId: challengeId }) - .then(res => res.challenges); + .then(res => res.challenges[0] || {}); } else { challenge = await this.private.getChallenges(`/challenges/${challengeId}`) .then(res => res.challenges); From 55f523100b8c4b2021a1217d7818013b08580442 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Sat, 29 Aug 2020 04:16:41 -0300 Subject: [PATCH 133/144] MM Details Page - Fix submissions member handle color and ratings --- src/actions/challenge.js | 21 +++++++-------------- src/utils/submission.js | 24 +++++------------------- 2 files changed, 12 insertions(+), 33 deletions(-) diff --git a/src/actions/challenge.js b/src/actions/challenge.js index c8fa4ace..f600bdc9 100644 --- a/src/actions/challenge.js +++ b/src/actions/challenge.js @@ -10,7 +10,6 @@ import { createActions } from 'redux-actions'; import { decodeToken } from 'tc-accounts'; import { getService as getChallengesService } from '../services/challenges'; import { getService as getSubmissionService } from '../services/submissions'; -import { getService as getMemberService } from '../services/members'; import { getApi } from '../services/api'; import * as submissionUtil from '../utils/submission'; @@ -147,25 +146,19 @@ function getMMSubmissionsInit(challengeId) { * @param {String} tokenV3 Topcoder auth token v3. * @return {Action} */ -function getMMSubmissionsDone(challengeId, registrants, tokenV3) { +function getMMSubmissionsDone(challengeId, tokenV3) { const filter = { challengeId }; - const memberService = getMemberService(tokenV3); const submissionsService = getSubmissionService(tokenV3); // TODO: Move those numbers to configs return getAll(params => submissionsService.getSubmissions(filter, params), 1, 500) .then((submissions) => { - const userIds = _.uniq(_.map(submissions, sub => sub.memberId)); - return memberService.getMembersInformation(userIds) - .then((resources) => { - const finalSubmissions = submissionUtil - .processMMSubmissions(submissions, resources, registrants); - return { - challengeId, - submissions: finalSubmissions, - tokenV3, - }; - }); + const finalSubmissions = submissionUtil.processMMSubmissions(submissions); + return { + challengeId, + submissions: finalSubmissions, + tokenV3, + }; }); } diff --git a/src/utils/submission.js b/src/utils/submission.js index 9f0c9274..eb0376ad 100644 --- a/src/utils/submission.js +++ b/src/utils/submission.js @@ -30,12 +30,6 @@ function toFixed(num, decimal) { return result; } -function getMMChallengeHandleStyle(handle, registrants) { - const style = _.get(_.find(registrants, m => m.handle === handle), 'colorStyle', null); - if (style) return JSON.parse(style.replace(/(\w+):\s*([^;]*)/g, '{"$1": "$2"}')); - return {}; -} - /** * Process each submission rank of MM challenge * @param submissions the array of submissions @@ -118,21 +112,14 @@ export function getFinalScore(submission) { * @param resources the challenge resources * @param registrants the challenge registrants */ -export function processMMSubmissions(submissions, resources, registrants) { +export function processMMSubmissions(submissions) { const data = {}; const result = []; _.each(submissions, (submission) => { const { memberId } = submission; - let memberHandle; - const resource = _.find(resources, r => _.get(r, 'userId').toString() === memberId.toString()); - if (_.isEmpty(resource)) { - memberHandle = memberId; - } else { - memberHandle = _.has(resource, 'handle') ? _.get(resource, 'handle') : memberId.toString(); - } - if (!data[memberHandle]) { - data[memberHandle] = []; + if (!data[memberId]) { + data[memberId] = []; } const validReviews = _.reject(submission.review, ['typeId', AV_SCAN_SCORER_REVIEW_TYPE_ID]); validReviews.sort((a, b) => { @@ -149,7 +136,7 @@ export function processMMSubmissions(submissions, resources, registrants) { const provisionalScore = toFixed(_.get(validReviews, '[0].score', '-'), 5); const finalScore = toFixed(_.get(submission, 'reviewSummation[0].aggregateScore', '-'), 5); - data[memberHandle].push({ + data[memberId].push({ submissionId: submission.id, submissionTime: submission.created, provisionalScore, @@ -163,8 +150,7 @@ export function processMMSubmissions(submissions, resources, registrants) { result.push({ submissions: [...value.sort((a, b) => new Date(b.submissionTime) .getTime() - new Date(a.submissionTime).getTime())], - member: key, - colorStyle: getMMChallengeHandleStyle(key, registrants), + memberId: key, }); }); From 16180e0f7c91c444479e7d7a1f52b2ae483fdcbf Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Mon, 31 Aug 2020 11:40:29 +0530 Subject: [PATCH 134/144] fix: for #4792 https://github.com/topcoder-platform/community-app/issues/4792 prakash https://github.com/topcoder-platform/topcoder-react-lib/pull/229 1.0.1 https://github.com/topcoder-platform/topcoder-react-lib/pull/234 1000.21.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8086c298..37a02bd1 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.20.3", + "version": "1000.21.0", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From afecf20286a1ee04d65598e9970cc4fb29158fe6 Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Mon, 31 Aug 2020 12:49:07 +0530 Subject: [PATCH 135/144] fix: for #4730 https://github.com/topcoder-platform/community-app/issues/4730 luiz https://github.com/topcoder-platform/community-app/pull/4832 https://github.com/topcoder-platform/topcoder-react-lib/pull/235 1000.21.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 37a02bd1..5337ec9d 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.21.0", + "version": "1000.21.1", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 55393b152830616000415a1e93282d59bf23179c Mon Sep 17 00:00:00 2001 From: Sushil Shinde <shinde.sushil@gmail.com> Date: Mon, 31 Aug 2020 14:16:46 +0530 Subject: [PATCH 136/144] fix: for #4782 https://github.com/topcoder-platform/community-app/issues/4782 cag https://github.com/topcoder-platform/community-app/pull/4825 https://github.com/topcoder-platform/topcoder-react-lib/pull/232 1000.21.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5337ec9d..4d48be6c 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.21.1", + "version": "1000.21.2", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 9e966464dc05d47c7bac75251a77b2b5f2d27308 Mon Sep 17 00:00:00 2001 From: Cagdas U <cagdasugurlu01@gmail.com> Date: Mon, 31 Aug 2020 15:02:44 +0300 Subject: [PATCH 137/144] Revert "fix(challenge-utils): update `filterByUsers` to use `userId`" This reverts commit c34961cf758b63c1d0cd87b00634a05262a534c7. --- src/utils/challenge/filter.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js index 549a36c3..117e0609 100644 --- a/src/utils/challenge/filter.js +++ b/src/utils/challenge/filter.js @@ -180,11 +180,8 @@ function filterByUpcoming(challenge, state) { } function filterByUsers(challenge, state) { - const userId = _.get(state, 'userId', null); - if (userId) { - return _.get(challenge, ['users', userId], false); - } - return true; + if (!state.userChallenges) return true; + return state.userChallenges.find(ch => challenge.id === ch); } /** From 85c25f82be3327d3a9b3072508956ef29c9991d6 Mon Sep 17 00:00:00 2001 From: narekcat <narekcat@gmail.com> Date: Mon, 31 Aug 2020 16:20:06 +0400 Subject: [PATCH 138/144] Fix for issue #4752 --- src/services/terms.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/services/terms.js b/src/services/terms.js index 224f825a..82184f1b 100644 --- a/src/services/terms.js +++ b/src/services/terms.js @@ -31,18 +31,14 @@ class TermsService { * @return {Promise} promise of the request result */ async getChallengeTerms(terms) { - if (this.private.tokenV3) { - const challengeService = getChallengeService(this.private.tokenV3); - const roleId = await challengeService.getRoleId('Submitter'); - const registerTerms = _.filter(terms, t => t.roleId === roleId); - - return Promise.all(_.map(registerTerms, term => this.getTermDetails(term.id))) - .then(challengeTerms => ( - _.map(challengeTerms, term => _.pick(term, 'id', 'title', 'agreed')) - )); - } - - return []; + const challengeService = getChallengeService(this.private.tokenV3); + const roleId = await challengeService.getRoleId('Submitter'); + const registerTerms = _.filter(terms, t => t.roleId === roleId); + + return Promise.all(_.map(registerTerms, term => this.getTermDetails(term.id))) + .then(challengeTerms => ( + _.map(challengeTerms, term => _.pick(term, 'id', 'title', 'agreed')) + )); } /** From 3aa228e92b1b76f73dc8bc5922cc9af05cc18c79 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Mon, 31 Aug 2020 14:18:35 -0300 Subject: [PATCH 139/144] Fix Review Opportunities QA filter --- src/services/reviewOpportunities.js | 6 +++--- src/utils/tc.js | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/services/reviewOpportunities.js b/src/services/reviewOpportunities.js index 87f8dcd3..9f3cdf31 100644 --- a/src/services/reviewOpportunities.js +++ b/src/services/reviewOpportunities.js @@ -21,11 +21,11 @@ export function normalizeChallenges(opportunities) { if (challenge.technologies) { if (challenge.technologies.includes(COMPETITION_TRACKS.DATA_SCIENCE)) { challenge.track = COMPETITION_TRACKS.DATA_SCIENCE; - } else if (challenge.technologies.includes(OLD_COMPETITION_TRACKS.QA)) { - challenge.track = COMPETITION_TRACKS.QA; } } else if (challenge.subTrack === OLD_SUBTRACKS.TEST_SUITES - || challenge.subTrack === OLD_SUBTRACKS.BUG_HUNT) { + || challenge.subTrack === OLD_SUBTRACKS.BUG_HUNT + || challenge.subTrack === OLD_COMPETITION_TRACKS.TEST_SCENARIOS + || challenge.subTrack === OLD_COMPETITION_TRACKS.TESTING_COMPETITION) { challenge.track = COMPETITION_TRACKS.QA; } else if (challenge.track === OLD_COMPETITION_TRACKS.DESIGN) { challenge.track = COMPETITION_TRACKS.DESIGN; diff --git a/src/utils/tc.js b/src/utils/tc.js index 28bcf3b2..ca97ace3 100644 --- a/src/utils/tc.js +++ b/src/utils/tc.js @@ -27,6 +27,8 @@ export const OLD_COMPETITION_TRACKS = { export const OLD_SUBTRACKS = { TEST_SUITES: 'TEST_SUITES', BUG_HUNT: 'BUG_HUNT', + TEST_SCENARIOS: 'TEST_SCENARIOS', + TESTING_COMPETITION: 'TESTING_COMPETITION', }; /** From c1cb920297b9ca7c90e516db657dda784f6258e5 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br> Date: Mon, 31 Aug 2020 14:20:35 -0300 Subject: [PATCH 140/144] Fix snapshot --- __tests__/__snapshots__/index.js.snap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index bf72ddb8..d8bdd649 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -385,6 +385,8 @@ Object { }, "OLD_SUBTRACKS": Object { "BUG_HUNT": "BUG_HUNT", + "TESTING_COMPETITION": "TESTING_COMPETITION", + "TEST_SCENARIOS": "TEST_SCENARIOS", "TEST_SUITES": "TEST_SUITES", }, "REVIEW_OPPORTUNITY_TYPES": Object { From f1aba187b8646531a08212dfa459d324acf9d961 Mon Sep 17 00:00:00 2001 From: Luiz Ricardo Rodrigues <contato@luizrrodrigues.com.br> Date: Mon, 31 Aug 2020 19:59:21 -0300 Subject: [PATCH 141/144] fix: for #4739 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4d48be6c..9312e245 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.21.2", + "version": "1000.21.3", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From c9cd37ea89049d7312f0e2ea6924e42dc226af22 Mon Sep 17 00:00:00 2001 From: Luiz Ricardo Rodrigues <contato@luizrrodrigues.com.br> Date: Tue, 1 Sep 2020 23:20:14 -0300 Subject: [PATCH 142/144] fix: for #4782 https://github.com/topcoder-platform/community-app/issues/4782 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9312e245..47aab80e 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.21.3", + "version": "1000.21.4", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From 7eee20186586c0abba181a0a938b9c1cb04665f7 Mon Sep 17 00:00:00 2001 From: Luiz Ricardo Rodrigues <contato@luizrrodrigues.com.br> Date: Tue, 1 Sep 2020 23:24:09 -0300 Subject: [PATCH 143/144] fix: for #4782 Issue: https://github.com/topcoder-platform/community-app/issues/4782 note: committed again because previous version already used. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 47aab80e..5afba0dc 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.21.4", + "version": "1000.21.7", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", From c59092ba318e467cdaacd9335383b3cb69520e09 Mon Sep 17 00:00:00 2001 From: Luiz Ricardo Rodrigues <contato@luizrrodrigues.com.br> Date: Thu, 3 Sep 2020 12:19:09 -0300 Subject: [PATCH 144/144] fix: for #4752 Issue: https://github.com/topcoder-platform/community-app/issues/4752 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5afba0dc..d1bb01a6 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.21.7", + "version": "1000.22.1", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0",