Skip to content

Commit 8b4ec96

Browse files
Merge pull request #5189 from topcoder-platform/new-forums
Smoke Testing 2020/11/12 - New forums
2 parents b2952f7 + d50d174 commit 8b4ec96

File tree

4 files changed

+57
-11
lines changed

4 files changed

+57
-11
lines changed

.circleci/config.yml

+1-1
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

+24-7
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

@@ -174,13 +177,27 @@ export default function ChallengeViewSelector(props) {
174177
) : null
175178
}
176179
{ (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>
180+
&& _.isEmpty(discuss)
181+
? (
182+
<a
183+
href={`${config.URL.FORUMS}${forumEndpoint}`}
184+
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
185+
target="_blank"
186+
rel="oopener noreferrer"
187+
>
188+
CHALLENGE FORUM
189+
</a>
190+
) : (
191+
discuss.map(d => (
192+
<a
193+
href={d.url}
194+
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
195+
target="_blank"
196+
rel="oopener noreferrer"
197+
>
198+
CHALLENGE DISCUSSION
199+
</a>
200+
))
184201
)
185202
}
186203
</div>

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

+27-3
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,
@@ -324,10 +325,31 @@ export default function SideBar({
324325
<p styleName="link-like-paragraph">
325326
Questions?
326327
&zwnj;
327-
<a href={forumLink}>
328-
Ask in the Challenge Discussion Forums.
329-
</a>
328+
{_.isEmpty(discuss) && (
329+
<a
330+
href={forumLink}
331+
target="_blank"
332+
rel="oopener noreferrer"
333+
>
334+
Ask in the Challenge Discussion Forums.
335+
</a>
336+
)}
330337
</p>
338+
{!_.isEmpty(discuss) && (
339+
<ul>
340+
{ discuss.map(d => (
341+
<li>
342+
<a
343+
href={d.url}
344+
target="_blank"
345+
rel="oopener noreferrer"
346+
>
347+
CHALLENGE DISCUSSION
348+
</a>
349+
</li>
350+
))}
351+
</ul>
352+
)}
331353
<h2>
332354
SOURCE FILES:
333355
</h2>
@@ -429,6 +451,7 @@ export default function SideBar({
429451

430452
SideBar.defaultProps = {
431453
eventDetail: null,
454+
discuss: [],
432455
documents: undefined,
433456
hasRegistered: false,
434457
reviewType: 'COMMUNITY',
@@ -454,6 +477,7 @@ SideBar.propTypes = {
454477
documents: PT.arrayOf(PT.shape()),
455478
shareable: PT.bool.isRequired,
456479
forumLink: PT.string.isRequired,
480+
discuss: PT.arrayOf(PT.shape()),
457481
hasRegistered: PT.bool,
458482
reviewType: PT.string,
459483
isDesign: PT.bool,

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

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ export default function ChallengeDetailsView(props) {
7676
codeRepo = codeRepoData.value;
7777
}
7878

79+
const discuss = _.get(challenge, 'discussions', []).filter(d => (
80+
d.type === 'challenge' && !_.isEmpty(d.url)
81+
));
82+
7983
let forumLink = track.toLowerCase() === 'design'
8084
? `/?module=ThreadList&forumID=${forumId}`
8185
: `/?module=Category&categoryID=${forumId}`;
@@ -351,6 +355,7 @@ export default function ChallengeDetailsView(props) {
351355
challengesUrl={challengesUrl}
352356
legacyId={legacyId}
353357
forumLink={forumLink}
358+
discuss={discuss}
354359
documents={documents}
355360
hasRegistered={hasRegistered}
356361
isDesign={track.toLowerCase() === 'design'}

0 commit comments

Comments
 (0)