Conversation
| const formatDate = date => moment(+new Date(date)).format('MMM DD, YYYY hh:mm A'); | ||
| const onDownloadSubmission = onDownload.bind(1, submissionObject.id); | ||
| const safeForDownloadCheck = safeForDownload(submissionObject.url); | ||
| const safeForDownloadCheck = safeForDownload(submissionObject); |
There was a problem hiding this comment.
[❗❗ correctness]
The safeForDownload function now receives the entire submissionObject instead of just the url. Ensure that safeForDownload is designed to handle the full object and that it uses the necessary properties correctly. This change could potentially introduce issues if safeForDownload is not updated accordingly.
|
|
||
| if (needReload === false && mySubmissions) { | ||
| if (mySubmissions.find(item => safeForDownload(item.url) !== true)) { | ||
| if (mySubmissions.find(item => safeForDownload(item) !== true)) { |
There was a problem hiding this comment.
[❗❗ correctness]
The safeForDownload function now takes an item object instead of item.url. Ensure that safeForDownload is designed to handle the entire object and not just a URL string. If safeForDownload expects a specific property from the object, verify that it is correctly accessing that property.
| export function safeForDownload(url) { | ||
| if (url == null) return 'Download link unavailable'; | ||
| export function safeForDownload(submission) { | ||
| if (submission == null || !submission.url) return 'Download link unavailable'; |
There was a problem hiding this comment.
[💡 readability]
The check submission == null || !submission.url could be simplified to !submission || !submission.url for better readability.
|
|
||
| if (url.toLowerCase().indexOf('submissions-quarantine/') !== -1) { | ||
| const { url } = submission; | ||
| if (url.toLowerCase().indexOf('submissions-quarantine/') !== -1 || submission.virusScan === false) { |
There was a problem hiding this comment.
[maintainability]
The condition submission.virusScan === false is redundant with the condition !submission.virusScan in the next block. Consider consolidating these checks for clarity and maintainability.
check "virusScan" flag when checking for submission status in my submissions