fix(files): Not-yet-downloaded files can be opened via double click

Fixes T4840
This commit is contained in:
Ben Gotow 2015-10-27 11:05:33 -07:00
parent b4eb8dc60c
commit 3a5f667a0b
2 changed files with 5 additions and 4 deletions

View file

@ -54,7 +54,7 @@ class AttachmentComponent extends React.Component
_canAbortDownload: -> true
_canClickToView: => not @props.removable and not @_isDownloading()
_canClickToView: => not @props.removable
_isDownloading: => @props.download?.state is "downloading"
@ -74,7 +74,8 @@ class AttachmentComponent extends React.Component
event.preventDefault()
return
_onClickView: => Actions.fetchAndOpenFile(@props.file) if @_canClickToView()
_onClickView: =>
Actions.fetchAndOpenFile(@props.file) if @_canClickToView()
_onClickRemove: (event) =>
Actions.removeFile

View file

@ -68,12 +68,12 @@ class Download
# a callback until the stream has ended. These helper functions ensure
# that resolve or reject is only fired once regardless of the order
# these two events (stream end and `success`) happen in.
streamEnded = ->
streamEnded = =>
finished = true
if finishedAction
finishedAction(@)
onStreamEnded = (action) ->
onStreamEnded = (action) =>
if finished
action(@)
else