@@ -585,8 +591,7 @@ class ChallengeDetailPageContainer extends React.Component { && ( Date: Thu, 11 Jun 2020 18:10:26 +0530 Subject: [PATCH 101/232] 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 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a5df87d860..8e1a673e77 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ "tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", - "topcoder-react-lib": "1000.19.13", + "topcoder-react-lib": "1000.19.14", "topcoder-react-ui-kit": "^1.0.11", "topcoder-react-utils": "0.7.8", "turndown": "^4.0.2", From 64ca2ff19c06a214dbf95ff249a3b5c7b36d4f16 Mon Sep 17 00:00:00 2001 From: Narek Vardzelyan Date: Thu, 11 Jun 2020 18:44:36 +0400 Subject: [PATCH 102/232] fix: issue #4438 --- src/shared/utils/challenge-detail/helper.jsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/shared/utils/challenge-detail/helper.jsx b/src/shared/utils/challenge-detail/helper.jsx index 7f379b7472..3f45591edf 100644 --- a/src/shared/utils/challenge-detail/helper.jsx +++ b/src/shared/utils/challenge-detail/helper.jsx @@ -202,14 +202,13 @@ export function getDisplayRecommendedChallenges( const displayRecommendedChallenges = recommendedChallenges[recommendedTag] ? recommendedChallenges[recommendedTag].challenges : []; const filterParams = getBuckets(null)[BUCKETS.OPEN_FOR_REGISTRATION].filter; - const userHandle = _.get(auth.user, 'handle'); + const userId = _.get(auth.user, 'userId'); const filter = Filter.getFilterFunction(filterParams); let results = _.filter(displayRecommendedChallenges, (c) => { let isValid = filter(c); - if (isValid && userHandle) { - // TODO: Find equivalent of !c.users[userHandle] - isValid = c.id !== challenge.id; + if (isValid && userId) { + isValid = !c.users[userId] && c.id !== challenge.id; } return isValid; }); From 8efa80dc80cde5937b844e456212f6d75ea7a969 Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda Date: Fri, 12 Jun 2020 13:19:00 +0800 Subject: [PATCH 103/232] fix issue 4519 --- .../Stats/SubTrackChallengeView/index.jsx | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/shared/components/ProfilePage/Stats/SubTrackChallengeView/index.jsx b/src/shared/components/ProfilePage/Stats/SubTrackChallengeView/index.jsx index f774b97029..1fadb2a65f 100644 --- a/src/shared/components/ProfilePage/Stats/SubTrackChallengeView/index.jsx +++ b/src/shared/components/ProfilePage/Stats/SubTrackChallengeView/index.jsx @@ -137,11 +137,20 @@ class SubTrackChallengeView extends React.Component { loadSRM, loadingMarathonUUID, loadMarathon, + userId, } = this.props; if (track === 'DEVELOP' || track === 'DESIGN') { if (!loadingSubTrackChallengesUUID) { - loadSubtrackChallenges(handle, auth.tokenV3, track, subTrack, 0, CHALLENGE_PER_PAGE, true); + loadSubtrackChallenges( + handle, + auth.tokenV3, + track, subTrack, + 0, + CHALLENGE_PER_PAGE, + true, + userId, + ); } } else if (track === 'DATA_SCIENCE') { if (subTrack === 'SRM') { @@ -168,6 +177,7 @@ class SubTrackChallengeView extends React.Component { loadSRM, loadingMarathonUUID, loadMarathon, + userId, } = this.props; const { @@ -184,6 +194,7 @@ class SubTrackChallengeView extends React.Component { pageNum + 1, CHALLENGE_PER_PAGE, false, + userId, ); this.setState({ pageNum: pageNum + 1 }); } @@ -400,7 +411,16 @@ function mapDispatchToProps(dispatch) { const action = actions.members; return { - loadSubtrackChallenges: (handle, tokenV3, track, subTrack, pageNum, pageSize, refresh) => { + loadSubtrackChallenges: ( + handle, + tokenV3, + track, + subTrack, + pageNum, + pageSize, + refresh, + userId, + ) => { const uuid = shortId(); dispatch(action.getSubtrackChallengesInit(handle, uuid)); dispatch(action.getSubtrackChallengesDone( @@ -412,6 +432,7 @@ function mapDispatchToProps(dispatch) { pageNum, pageSize, refresh, + userId, )); }, loadSRM: (handle, tokenV3, pageNum, pageSize, refresh) => { From d0a084666324967b1d9465add8c1eaae88b2abf9 Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Fri, 12 Jun 2020 20:34:33 +0530 Subject: [PATCH 104/232] fix: #4519 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 8e1a673e77..e5736c5fe4 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ "tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", - "topcoder-react-lib": "1000.19.14", + "topcoder-react-lib": "1000.19.15", "topcoder-react-ui-kit": "^1.0.11", "topcoder-react-utils": "0.7.8", "turndown": "^4.0.2", From 4d7c8c44f17ec1b298ee6b8244efc74f623c07e2 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Fri, 12 Jun 2020 12:19:02 -0300 Subject: [PATCH 105/232] Removed proxyApi to challenge details --- src/server/index.js | 63 --------------------------------------------- 1 file changed, 63 deletions(-) diff --git a/src/server/index.js b/src/server/index.js index c8da5ea563..38706d87ff 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -145,69 +145,6 @@ async function onExpressJsSetup(server) { tcCommunitiesDemoApi, ); - // Get roleId by name - server.use( - '/community-app-assets/api/challenges/roleId', - async (req, res, next) => { - let tokenM2M = ''; - try { - tokenM2M = await services.api.getTcM2mToken(); - } catch (err) { - logger.error('proxyApi-roleId-getTcM2mToken : ', err); - } - - const params = { - name: req.query.name, - isActive: true, - }; - const url = `${config.API.V5}/resource-roles?${qs.stringify(params)}`; - try { - let data = await fetch(url, { - headers: { Authorization: `Bearer ${tokenM2M}` }, - }); - data = await data.text(); - res.send(data); - } catch (err) { - next(err); - } - }, - ); - - // Get registrants from challenge - server.use( - '/community-app-assets/api/challenges/:challengeId/registrants', - async (req, res, next) => { - let tokenM2M = ''; - let roleId = ''; - try { - tokenM2M = await services.api.getTcM2mToken(); - } catch (err) { - logger.error('proxyApi-registrants-getTcM2mToken : ', err); - } - - try { - roleId = await services.challenge.getService().getRoleId('Submitter'); - } catch (err) { - logger.error('proxyApi-registrants-getRoleId : ', err); - } - - const params = { - challengeId: req.params.challengeId, - roleId, - }; - const url = `${config.API.V5}/resources?${qs.stringify(params)}`; - try { - let data = await fetch(url, { - headers: { Authorization: `Bearer ${tokenM2M}` }, - }); - data = await data.text(); - res.send(data); - } catch (err) { - next(err); - } - }, - ); - server.use( '/community-app-assets/api/edit-contentful-entry/:id', (req, res) => res.redirect(`${CMS_BASE_URL}/entries/${req.params.id}`), From 476e8441318a885df6e5e9a069e15e75900b575f Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Fri, 12 Jun 2020 12:20:38 -0300 Subject: [PATCH 106/232] Updated isRegistered function, now Lib will return this. --- .../containers/SubmissionManagement/index.jsx | 7 +----- src/shared/containers/SubmissionPage.jsx | 10 ++------ .../containers/challenge-detail/index.jsx | 24 +++++-------------- 3 files changed, 9 insertions(+), 32 deletions(-) diff --git a/src/shared/containers/SubmissionManagement/index.jsx b/src/shared/containers/SubmissionManagement/index.jsx index b849323beb..769c6b5379 100644 --- a/src/shared/containers/SubmissionManagement/index.jsx +++ b/src/shared/containers/SubmissionManagement/index.jsx @@ -52,7 +52,6 @@ class SubmissionManagementPageContainer extends React.Component { deleting, loadingSubmissionsForChallengeId, submissionPhaseStartDate, - handle, isLoadingChallenge, mySubmissions, onCancelSubmissionDelete, @@ -60,13 +59,11 @@ class SubmissionManagementPageContainer extends React.Component { onShowDetails, onSubmissionDelete, onSubmissionDeleteConfirmed, - registrants, showDetails, showModal, toBeDeletedId, } = this.props; - const isRegistered = registrants.find(r => _.toString(r.memberHandle) === _.toString(handle)); - if (!isRegistered) return ; + if (!challenge.isRegistered) return ; const isEmpty = _.isEmpty(challenge); const smConfig = { @@ -189,8 +186,6 @@ SubmissionManagementPageContainer.propTypes = { toBeDeletedId: PT.number, onSubmissionDeleteConfirmed: PT.func.isRequired, submissionPhaseStartDate: PT.string.isRequired, - registrants: PT.arrayOf(PT.object).isRequired, - handle: PT.string.isRequired, }; function mapStateToProps(state, props) { diff --git a/src/shared/containers/SubmissionPage.jsx b/src/shared/containers/SubmissionPage.jsx index 4505291471..fec5e0170b 100644 --- a/src/shared/containers/SubmissionPage.jsx +++ b/src/shared/containers/SubmissionPage.jsx @@ -13,7 +13,6 @@ import { PrimaryButton } from 'topcoder-react-ui-kit'; import shortId from 'shortid'; import React from 'react'; import PT from 'prop-types'; -import _ from 'lodash'; import { connect } from 'react-redux'; import SubmissionsPage from 'components/SubmissionPage'; import AccessDenied, { CAUSE as ACCESS_DENIED_REASON } from 'components/tc-communities/AccessDenied'; @@ -52,9 +51,8 @@ class SubmissionsPageContainer extends React.Component { } render() { - const { registrants, handle, challengeId } = this.props; - const isRegistered = registrants.find(r => _.toString(r.memberHandle) === _.toString(handle)); - if (!isRegistered) { + const { challenge, challengeId } = this.props; + if (!challenge.isRegistered) { return ( @@ -134,9 +132,7 @@ SubmissionsPageContainer.propTypes = { updateNotesLength: PT.func.isRequired, setSubmissionFilestackData: PT.func.isRequired, submissionFilestackData: filestackDataProp.isRequired, - registrants: PT.arrayOf(PT.object).isRequired, winners: PT.arrayOf(PT.object).isRequired, - handle: PT.string.isRequired, }; /** @@ -174,9 +170,7 @@ const mapStateToProps = (state, ownProps) => { filePickers: submission.filePickers, notesLength: submission.notesLength, submissionFilestackData: submission.submissionFilestackData, - registrants: state.challenge.details.registrants, winners: state.challenge.details.winners, - handle: state.auth.user ? state.auth.user.handle : '', }; }; diff --git a/src/shared/containers/challenge-detail/index.jsx b/src/shared/containers/challenge-detail/index.jsx index b494f53ade..446be85b14 100644 --- a/src/shared/containers/challenge-detail/index.jsx +++ b/src/shared/containers/challenge-detail/index.jsx @@ -112,13 +112,6 @@ function getOgImage(challenge, challengeTypes) { } } -function isRegistered(registrants, handle) { - if (_.find(registrants, r => _.toString(r.memberHandle) === _.toString(handle))) { - return true; - } - return false; -} - // The container component class ChallengeDetailPageContainer extends React.Component { constructor(props, context) { @@ -394,11 +387,6 @@ class ChallengeDetailPageContainer extends React.Component { const isEmpty = _.isEmpty(challenge); const isLegacyMM = isMM(challenge) && Boolean(challenge.roundId); - const hasRegistered = isRegistered( - challenge.registrants, - (auth.user || {}).handle, - ); - if (isLoadingChallenge || isLoadingTerms) { return ; } @@ -469,12 +457,12 @@ class ChallengeDetailPageContainer extends React.Component { } unregistering={unregistering} checkpoints={checkpoints} - hasRegistered={hasRegistered} + hasRegistered={challenge.isRegistered} hasFirstPlacement={hasFirstPlacement} challengeSubtracksMap={challengeSubtracksMap} isMenuOpened={isMenuOpened} submissionEnded={submissionEnded} - mySubmissions={hasRegistered ? mySubmissions : []} + mySubmissions={challenge.isRegistered ? mySubmissions : []} /> ) } @@ -488,7 +476,7 @@ class ChallengeDetailPageContainer extends React.Component { description={challenge.name} detailedRequirements={challenge.description} terms={terms} - hasRegistered={hasRegistered} + hasRegistered={challenge.isRegistered} savingChallenge={savingChallenge} setSpecsTabState={setSpecsTabState} specsTabState={specsTabState} @@ -548,7 +536,7 @@ class ChallengeDetailPageContainer extends React.Component { this.setState({ notFoundCountryFlagUrl }); }} onSortChange={sort => this.setState({ submissionsSort: sort })} - hasRegistered={hasRegistered} + hasRegistered={challenge.isRegistered} unregistering={unregistering} isLegacyMM={isLegacyMM} submissionEnded={submissionEnded} @@ -562,14 +550,14 @@ class ChallengeDetailPageContainer extends React.Component { this.setState({ mySubmissionsSort: sort })} From 59ececa90ce78a9d661ae12db1da7c511809d2bc Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Sat, 13 Jun 2020 06:55:02 +0530 Subject: [PATCH 107/232] fix: for. #4380 temp 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 e5736c5fe4..afeb3318f0 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ "tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", - "topcoder-react-lib": "1000.19.15", + "topcoder-react-lib": "1000.19.16", "topcoder-react-ui-kit": "^1.0.11", "topcoder-react-utils": "0.7.8", "turndown": "^4.0.2", From 1b7a98a13fc3c573d00f72f5c77b5fdbda7a794d Mon Sep 17 00:00:00 2001 From: Narek Vardzelyan Date: Sat, 13 Jun 2020 12:10:17 +0400 Subject: [PATCH 108/232] fix: fix UI issue in recommended active challenges card --- .../RecommendedActiveChallenges/ChallengesCard/index.jsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/shared/components/challenge-detail/RecommendedActiveChallenges/ChallengesCard/index.jsx b/src/shared/components/challenge-detail/RecommendedActiveChallenges/ChallengesCard/index.jsx index 96053c9871..093c6fd0fd 100644 --- a/src/shared/components/challenge-detail/RecommendedActiveChallenges/ChallengesCard/index.jsx +++ b/src/shared/components/challenge-detail/RecommendedActiveChallenges/ChallengesCard/index.jsx @@ -8,7 +8,6 @@ import { getEndDate, PRIZE_MODE, getPrizePurseUI, - getPrizePointsUI, getTimeLeft, } from 'utils/challenge-detail/helper'; @@ -88,7 +87,6 @@ export default function ChallengesCard({
{getPrizePurseUI(challenge, prizeMode, true, 'Prize Purse')} - {getPrizePointsUI(challenge)}