Skip to content

Release 2020/11/12 (v1.6.0) - New Forums #5191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Nov 12, 2020
Merged
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -173,16 +176,37 @@ export default function ChallengeViewSelector(props) {
</a>
) : null
}
{ (hasRegistered || Boolean(roles.length))
&& (
<a
href={`${config.URL.FORUMS}${forumEndpoint}`}
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
>
CHALLENGE FORUM
</a>
)
}
{ (() => {
if (hasRegistered || Boolean(roles.length)) {
if (!_.isEmpty(discuss)) {
return (
discuss.map(d => (
<a
href={d.url}
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
target="_blank"
rel="oopener noreferrer"
>
CHALLENGE DISCUSSION
</a>
))
);
}
if (forumId > 0) {
return (
<a
href={`${config.URL.FORUMS}${forumEndpoint}`}
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
target="_blank"
rel="oopener noreferrer"
>
CHALLENGE FORUM
</a>
);
}
}
return '';
})()}
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default function SideBar({
eventDetail,
shareable,
forumLink,
discuss,
hasRegistered,
reviewType,
isDesign,
Expand Down Expand Up @@ -321,13 +322,36 @@ export default function SideBar({
pass screening.
</a>
</p>
<p styleName="link-like-paragraph">
Questions?
&zwnj;
<a href={forumLink}>
Ask in the Challenge Discussion Forums.
</a>
</p>
{(forumLink || !_.isEmpty(discuss)) && (
<p styleName="link-like-paragraph">
Questions?
&zwnj;
{_.isEmpty(discuss) && (
<a
href={forumLink}
target="_blank"
rel="oopener noreferrer"
>
Ask in the Challenge Discussion Forums.
</a>
)}
</p>
)}
{!_.isEmpty(discuss) && (
<ul>
{ discuss.map(d => (
<li>
<a
href={d.url}
target="_blank"
rel="oopener noreferrer"
>
CHALLENGE DISCUSSION
</a>
</li>
))}
</ul>
)}
<h2>
SOURCE FILES:
</h2>
Expand Down Expand Up @@ -429,6 +453,7 @@ export default function SideBar({

SideBar.defaultProps = {
eventDetail: null,
discuss: [],
documents: undefined,
hasRegistered: false,
reviewType: 'COMMUNITY',
Expand All @@ -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,
Expand Down
15 changes: 11 additions & 4 deletions src/shared/components/challenge-detail/Specification/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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'}
Expand Down