1414import _ from 'lodash' ;
1515import moment from 'moment' ;
1616import React from 'react' ;
17- import { COMPETITION_TRACKS , CHALLENGE_STATUS } from 'utils/tc' ;
17+ import { COMPETITION_TRACKS , CHALLENGE_STATUS , safeForDownload } from 'utils/tc' ;
1818
1919import PT from 'prop-types' ;
2020
@@ -38,6 +38,7 @@ export default function Submission(props) {
3838 } = props ;
3939 const formatDate = date => moment ( + new Date ( date ) ) . format ( 'MMM DD, YYYY hh:mm A' ) ;
4040 const onDownloadSubmission = onDownload . bind ( 1 , submissionObject . id ) ;
41+ const safeForDownloadCheck = safeForDownload ( submissionObject . url ) ;
4142
4243 return (
4344 < tr styleName = "submission-row" >
@@ -54,7 +55,7 @@ export default function Submission(props) {
5455 {
5556 track === COMPETITION_TRACKS . DES && (
5657 < td styleName = "status-col" >
57- { submissionObject . screening
58+ { safeForDownloadCheck !== true ? safeForDownloadCheck : submissionObject . screening
5859 && (
5960 < ScreeningStatus
6061 screeningObject = { submissionObject . screening }
@@ -71,7 +72,7 @@ export default function Submission(props) {
7172 onClick = { ( ) => onDownloadSubmission ( submissionObject . id ) }
7273 type = "button"
7374 >
74- < DownloadIcon />
75+ { safeForDownloadCheck === true && < DownloadIcon /> }
7576 </ button >
7677 { /*
7778 TODO: At the moment we just fetch downloads from the legacy
@@ -127,6 +128,7 @@ Submission.propTypes = {
127128 type : PT . string ,
128129 created : PT . any ,
129130 download : PT . any ,
131+ url : PT . string ,
130132 } ) ,
131133 showScreeningDetails : PT . bool ,
132134 track : PT . string . isRequired ,
0 commit comments