diff --git a/.circleci/config.yml b/.circleci/config.yml index 9a24c6244f..23b1d90989 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -244,7 +244,7 @@ workflows: filters: branches: only: - - issue-5041 + - free # This is beta env for production soft releases - "build-prod-beta": context : org-global diff --git a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx index 98df8985c4..0445677aa7 100644 --- a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx +++ b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx @@ -36,6 +36,9 @@ export default function ChallengeViewSelector(props) { const numOfSub = numOfSubmissions + (numOfCheckpointSubmissions || 0); const forumId = _.get(challenge, 'legacy.forumId') || 0; + const discuss = _.get(challenge, 'discussions', []).filter(d => ( + d.type === 'challenge' && !_.isEmpty(d.url) + )); const roles = _.get(challenge, 'userDetails.roles') || []; const isDesign = trackLower === 'design'; @@ -173,16 +176,37 @@ export default function ChallengeViewSelector(props) { ) : null } - { (hasRegistered || Boolean(roles.length)) - && ( - - CHALLENGE FORUM - - ) - } + { (() => { + if (hasRegistered || Boolean(roles.length)) { + if (!_.isEmpty(discuss)) { + return ( + discuss.map(d => ( + + CHALLENGE DISCUSSION + + )) + ); + } + if (forumId > 0) { + return ( + + CHALLENGE FORUM + + ); + } + } + return ''; + })()} ); diff --git a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx index 5b4fe7aa2c..793278de7d 100644 --- a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx +++ b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx @@ -21,6 +21,7 @@ export default function SideBar({ eventDetail, shareable, forumLink, + discuss, hasRegistered, reviewType, isDesign, @@ -321,13 +322,36 @@ export default function SideBar({ pass screening.

-

- Questions? - ‌ - - Ask in the Challenge Discussion Forums. - -

+ {(forumLink || !_.isEmpty(discuss)) && ( +

+ Questions? + ‌ + {_.isEmpty(discuss) && ( + + Ask in the Challenge Discussion Forums. + + )} +

+ )} + {!_.isEmpty(discuss) && ( + + )}

SOURCE FILES:

@@ -429,6 +453,7 @@ export default function SideBar({ SideBar.defaultProps = { eventDetail: null, + discuss: [], documents: undefined, hasRegistered: false, reviewType: 'COMMUNITY', @@ -454,6 +479,7 @@ SideBar.propTypes = { documents: PT.arrayOf(PT.shape()), shareable: PT.bool.isRequired, forumLink: PT.string.isRequired, + discuss: PT.arrayOf(PT.shape()), hasRegistered: PT.bool, reviewType: PT.string, isDesign: PT.bool, diff --git a/src/shared/components/challenge-detail/Specification/index.jsx b/src/shared/components/challenge-detail/Specification/index.jsx index 9f5608931a..f61d3401ef 100644 --- a/src/shared/components/challenge-detail/Specification/index.jsx +++ b/src/shared/components/challenge-detail/Specification/index.jsx @@ -76,10 +76,16 @@ export default function ChallengeDetailsView(props) { codeRepo = codeRepoData.value; } - let forumLink = track.toLowerCase() === 'design' - ? `/?module=ThreadList&forumID=${forumId}` - : `/?module=Category&categoryID=${forumId}`; - forumLink = `${config.URL.FORUMS}${forumLink}`; + const discuss = _.get(challenge, 'discussions', []).filter(d => ( + d.type === 'challenge' && !_.isEmpty(d.url) + )); + + let forumLink = ''; + if (forumId > 0) { + forumLink = track.toLowerCase() === 'design' + ? `/?module=ThreadList&forumID=${forumId}` + : `/?module=Category&categoryID=${forumId}`; + } let isWipro = false; const wiproCommunity = communitiesList.find(x => x.communityId === 'wipro'); @@ -351,6 +357,7 @@ export default function ChallengeDetailsView(props) { challengesUrl={challengesUrl} legacyId={legacyId} forumLink={forumLink} + discuss={discuss} documents={documents} hasRegistered={hasRegistered} isDesign={track.toLowerCase() === 'design'}