File tree Expand file tree Collapse file tree 4 files changed +79
-22
lines changed
src/shared/components/challenge-detail Expand file tree Collapse file tree 4 files changed +79
-22
lines changed Original file line number Diff line number Diff line change @@ -244,7 +244,7 @@ workflows:
244
244
filters :
245
245
branches :
246
246
only :
247
- - issue-5041
247
+ - free
248
248
# This is beta env for production soft releases
249
249
- " build-prod-beta " :
250
250
context : org-global
Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ export default function ChallengeViewSelector(props) {
36
36
37
37
const numOfSub = numOfSubmissions + ( numOfCheckpointSubmissions || 0 ) ;
38
38
const forumId = _ . get ( challenge , 'legacy.forumId' ) || 0 ;
39
+ const discuss = _ . get ( challenge , 'discussions' , [ ] ) . filter ( d => (
40
+ d . type === 'challenge' && ! _ . isEmpty ( d . url )
41
+ ) ) ;
39
42
const roles = _ . get ( challenge , 'userDetails.roles' ) || [ ] ;
40
43
const isDesign = trackLower === 'design' ;
41
44
@@ -173,16 +176,37 @@ export default function ChallengeViewSelector(props) {
173
176
</ a >
174
177
) : null
175
178
}
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
+ } ) ( ) }
186
210
</ div >
187
211
</ div >
188
212
) ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export default function SideBar({
21
21
eventDetail,
22
22
shareable,
23
23
forumLink,
24
+ discuss,
24
25
hasRegistered,
25
26
reviewType,
26
27
isDesign,
@@ -321,13 +322,36 @@ export default function SideBar({
321
322
pass screening.
322
323
</ a >
323
324
</ p >
324
- < p styleName = "link-like-paragraph" >
325
- Questions?
326
- ‌
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
+ ‌
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
+ ) }
331
355
< h2 >
332
356
SOURCE FILES:
333
357
</ h2 >
@@ -429,6 +453,7 @@ export default function SideBar({
429
453
430
454
SideBar . defaultProps = {
431
455
eventDetail : null ,
456
+ discuss : [ ] ,
432
457
documents : undefined ,
433
458
hasRegistered : false ,
434
459
reviewType : 'COMMUNITY' ,
@@ -454,6 +479,7 @@ SideBar.propTypes = {
454
479
documents : PT . arrayOf ( PT . shape ( ) ) ,
455
480
shareable : PT . bool . isRequired ,
456
481
forumLink : PT . string . isRequired ,
482
+ discuss : PT . arrayOf ( PT . shape ( ) ) ,
457
483
hasRegistered : PT . bool ,
458
484
reviewType : PT . string ,
459
485
isDesign : PT . bool ,
Original file line number Diff line number Diff line change @@ -76,10 +76,16 @@ export default function ChallengeDetailsView(props) {
76
76
codeRepo = codeRepoData . value ;
77
77
}
78
78
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
+ }
83
89
84
90
let isWipro = false ;
85
91
const wiproCommunity = communitiesList . find ( x => x . communityId === 'wipro' ) ;
@@ -351,6 +357,7 @@ export default function ChallengeDetailsView(props) {
351
357
challengesUrl = { challengesUrl }
352
358
legacyId = { legacyId }
353
359
forumLink = { forumLink }
360
+ discuss = { discuss }
354
361
documents = { documents }
355
362
hasRegistered = { hasRegistered }
356
363
isDesign = { track . toLowerCase ( ) === 'design' }
You can’t perform that action at this time.
0 commit comments