14
14
import _ from 'lodash' ;
15
15
import moment from 'moment' ;
16
16
import React from 'react' ;
17
- import { COMPETITION_TRACKS , CHALLENGE_STATUS } from 'utils/tc' ;
17
+ import { COMPETITION_TRACKS , CHALLENGE_STATUS , safeForDownload } from 'utils/tc' ;
18
18
19
19
import PT from 'prop-types' ;
20
20
@@ -38,6 +38,7 @@ export default function Submission(props) {
38
38
} = props ;
39
39
const formatDate = date => moment ( + new Date ( date ) ) . format ( 'MMM DD, YYYY hh:mm A' ) ;
40
40
const onDownloadSubmission = onDownload . bind ( 1 , submissionObject . id ) ;
41
+ const safeForDownloadCheck = safeForDownload ( submissionObject . url ) ;
41
42
42
43
return (
43
44
< tr styleName = "submission-row" >
@@ -54,7 +55,7 @@ export default function Submission(props) {
54
55
{
55
56
track === COMPETITION_TRACKS . DES && (
56
57
< td styleName = "status-col" >
57
- { submissionObject . screening
58
+ { safeForDownloadCheck !== true ? safeForDownloadCheck : submissionObject . screening
58
59
&& (
59
60
< ScreeningStatus
60
61
screeningObject = { submissionObject . screening }
@@ -71,7 +72,7 @@ export default function Submission(props) {
71
72
onClick = { ( ) => onDownloadSubmission ( submissionObject . id ) }
72
73
type = "button"
73
74
>
74
- < DownloadIcon />
75
+ { safeForDownloadCheck === true && < DownloadIcon /> }
75
76
</ button >
76
77
{ /*
77
78
TODO: At the moment we just fetch downloads from the legacy
@@ -127,6 +128,7 @@ Submission.propTypes = {
127
128
type : PT . string ,
128
129
created : PT . any ,
129
130
download : PT . any ,
131
+ url : PT . string ,
130
132
} ) ,
131
133
showScreeningDetails : PT . bool ,
132
134
track : PT . string . isRequired ,
0 commit comments