Skip to content

Commit 2a3ffcc

Browse files
authored
Merge pull request #5191 from topcoder-platform/develop
Release 2020/11/12 (v1.6.0) - New Forums
2 parents ded1fde + ce63e59 commit 2a3ffcc

File tree

4 files changed

+79
-22
lines changed

4 files changed

+79
-22
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ workflows:
244244
filters:
245245
branches:
246246
only:
247-
- issue-5041
247+
- free
248248
# This is beta env for production soft releases
249249
- "build-prod-beta":
250250
context : org-global

src/shared/components/challenge-detail/Header/TabSelector/index.jsx

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ export default function ChallengeViewSelector(props) {
3636

3737
const numOfSub = numOfSubmissions + (numOfCheckpointSubmissions || 0);
3838
const forumId = _.get(challenge, 'legacy.forumId') || 0;
39+
const discuss = _.get(challenge, 'discussions', []).filter(d => (
40+
d.type === 'challenge' && !_.isEmpty(d.url)
41+
));
3942
const roles = _.get(challenge, 'userDetails.roles') || [];
4043
const isDesign = trackLower === 'design';
4144

@@ -173,16 +176,37 @@ export default function ChallengeViewSelector(props) {
173176
</a>
174177
) : null
175178
}
176-
{ (hasRegistered || Boolean(roles.length))
177-
&& (
178-
<a
179-
href={`${config.URL.FORUMS}${forumEndpoint}`}
180-
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
181-
>
182-
CHALLENGE FORUM
183-
</a>
184-
)
185-
}
179+
{ (() => {
180+
if (hasRegistered || Boolean(roles.length)) {
181+
if (!_.isEmpty(discuss)) {
182+
return (
183+
discuss.map(d => (
184+
<a
185+
href={d.url}
186+
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
187+
target="_blank"
188+
rel="oopener noreferrer"
189+
>
190+
CHALLENGE DISCUSSION
191+
</a>
192+
))
193+
);
194+
}
195+
if (forumId > 0) {
196+
return (
197+
<a
198+
href={`${config.URL.FORUMS}${forumEndpoint}`}
199+
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
200+
target="_blank"
201+
rel="oopener noreferrer"
202+
>
203+
CHALLENGE FORUM
204+
</a>
205+
);
206+
}
207+
}
208+
return '';
209+
})()}
186210
</div>
187211
</div>
188212
);

src/shared/components/challenge-detail/Specification/SideBar/index.jsx

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default function SideBar({
2121
eventDetail,
2222
shareable,
2323
forumLink,
24+
discuss,
2425
hasRegistered,
2526
reviewType,
2627
isDesign,
@@ -321,13 +322,36 @@ export default function SideBar({
321322
pass screening.
322323
</a>
323324
</p>
324-
<p styleName="link-like-paragraph">
325-
Questions?
326-
&zwnj;
327-
<a href={forumLink}>
328-
Ask in the Challenge Discussion Forums.
329-
</a>
330-
</p>
325+
{(forumLink || !_.isEmpty(discuss)) && (
326+
<p styleName="link-like-paragraph">
327+
Questions?
328+
&zwnj;
329+
{_.isEmpty(discuss) && (
330+
<a
331+
href={forumLink}
332+
target="_blank"
333+
rel="oopener noreferrer"
334+
>
335+
Ask in the Challenge Discussion Forums.
336+
</a>
337+
)}
338+
</p>
339+
)}
340+
{!_.isEmpty(discuss) && (
341+
<ul>
342+
{ discuss.map(d => (
343+
<li>
344+
<a
345+
href={d.url}
346+
target="_blank"
347+
rel="oopener noreferrer"
348+
>
349+
CHALLENGE DISCUSSION
350+
</a>
351+
</li>
352+
))}
353+
</ul>
354+
)}
331355
<h2>
332356
SOURCE FILES:
333357
</h2>
@@ -429,6 +453,7 @@ export default function SideBar({
429453

430454
SideBar.defaultProps = {
431455
eventDetail: null,
456+
discuss: [],
432457
documents: undefined,
433458
hasRegistered: false,
434459
reviewType: 'COMMUNITY',
@@ -454,6 +479,7 @@ SideBar.propTypes = {
454479
documents: PT.arrayOf(PT.shape()),
455480
shareable: PT.bool.isRequired,
456481
forumLink: PT.string.isRequired,
482+
discuss: PT.arrayOf(PT.shape()),
457483
hasRegistered: PT.bool,
458484
reviewType: PT.string,
459485
isDesign: PT.bool,

src/shared/components/challenge-detail/Specification/index.jsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,16 @@ export default function ChallengeDetailsView(props) {
7676
codeRepo = codeRepoData.value;
7777
}
7878

79-
let forumLink = track.toLowerCase() === 'design'
80-
? `/?module=ThreadList&forumID=${forumId}`
81-
: `/?module=Category&categoryID=${forumId}`;
82-
forumLink = `${config.URL.FORUMS}${forumLink}`;
79+
const discuss = _.get(challenge, 'discussions', []).filter(d => (
80+
d.type === 'challenge' && !_.isEmpty(d.url)
81+
));
82+
83+
let forumLink = '';
84+
if (forumId > 0) {
85+
forumLink = track.toLowerCase() === 'design'
86+
? `/?module=ThreadList&forumID=${forumId}`
87+
: `/?module=Category&categoryID=${forumId}`;
88+
}
8389

8490
let isWipro = false;
8591
const wiproCommunity = communitiesList.find(x => x.communityId === 'wipro');
@@ -351,6 +357,7 @@ export default function ChallengeDetailsView(props) {
351357
challengesUrl={challengesUrl}
352358
legacyId={legacyId}
353359
forumLink={forumLink}
360+
discuss={discuss}
354361
documents={documents}
355362
hasRegistered={hasRegistered}
356363
isDesign={track.toLowerCase() === 'design'}

0 commit comments

Comments
 (0)