diff options
-rw-r--r-- | web/react/components/create_comment.jsx | 18 | ||||
-rw-r--r-- | web/react/components/create_post.jsx | 18 | ||||
-rw-r--r-- | web/react/components/file_upload.jsx | 7 | ||||
-rw-r--r-- | web/react/components/file_upload_overlay.jsx | 22 |
4 files changed, 36 insertions, 29 deletions
diff --git a/web/react/components/create_comment.jsx b/web/react/components/create_comment.jsx index c954229ae..885efab7a 100644 --- a/web/react/components/create_comment.jsx +++ b/web/react/components/create_comment.jsx @@ -122,16 +122,20 @@ module.exports = React.createClass({ this.setState({uploadsInProgress: draft['uploadsInProgress'], previews: draft['previews']}); }, handleUploadError: function(err, clientId) { - var draft = PostStore.getCommentDraft(this.props.rootId); + if (clientId !== -1) { + var draft = PostStore.getCommentDraft(this.props.rootId); - var index = draft['uploadsInProgress'].indexOf(clientId); - if (index !== -1) { - draft['uploadsInProgress'].splice(index, 1); - } + var index = draft['uploadsInProgress'].indexOf(clientId); + if (index !== -1) { + draft['uploadsInProgress'].splice(index, 1); + } - PostStore.storeCommentDraft(this.props.rootId, draft); + PostStore.storeCommentDraft(this.props.rootId, draft); - this.setState({uploadsInProgress: draft['uploadsInProgress'], serverError: err}); + this.setState({uploadsInProgress: draft['uploadsInProgress'], serverError: err}); + } else { + this.setState({serverError: err}); + } }, clearPreviews: function() { this.setState({previews: []}); diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx index 137420440..377e7bd34 100644 --- a/web/react/components/create_post.jsx +++ b/web/react/components/create_post.jsx @@ -145,16 +145,20 @@ module.exports = React.createClass({ this.setState({uploadsInProgress: draft['uploadsInProgress'], previews: draft['previews']}); }, handleUploadError: function(err, clientId) { - var draft = PostStore.getDraft(this.state.channelId); + if (clientId !== -1) { + var draft = PostStore.getDraft(this.state.channelId); - var index = draft['uploadsInProgress'].indexOf(clientId); - if (index !== -1) { - draft['uploadsInProgress'].splice(index, 1); - } + var index = draft['uploadsInProgress'].indexOf(clientId); + if (index !== -1) { + draft['uploadsInProgress'].splice(index, 1); + } - PostStore.storeDraft(this.state.channelId, draft); + PostStore.storeDraft(this.state.channelId, draft); - this.setState({uploadsInProgress: draft['uploadsInProgress'], serverError: err}); + this.setState({uploadsInProgress: draft['uploadsInProgress'], serverError: err}); + } else { + this.setState({serverError: err}); + } }, removePreview: function(id) { var previews = this.state.previews; diff --git a/web/react/components/file_upload.jsx b/web/react/components/file_upload.jsx index f1a06c361..2bce1b537 100644 --- a/web/react/components/file_upload.jsx +++ b/web/react/components/file_upload.jsx @@ -91,9 +91,6 @@ module.exports = React.createClass({ this.props.onUploadError(null); var files = e.originalEvent.dataTransfer.files; - if (!files.length) { - files = e.originalEvent.dataTransfer.getData('URL'); - } var channelId = this.props.channelId || ChannelStore.getCurrentId(); if (typeof files !== 'string' && files.length) { @@ -142,6 +139,8 @@ module.exports = React.createClass({ this.props.onUploadStart([clientId], channelId); } + } else { + this.props.onUploadError('Invalid file upload', -1); } }, componentDidMount: function() { @@ -149,7 +148,7 @@ module.exports = React.createClass({ var self = this; if (this.props.postType === 'post') { - $('.app__content').dragster({ + $('.row.main').dragster({ enter: function(dragsterEvent, e) { $('.center-file-overlay').removeClass('invisible'); $('.center-file-overlay').addClass('visible'); diff --git a/web/react/components/file_upload_overlay.jsx b/web/react/components/file_upload_overlay.jsx index 5f8ef0b0c..a82f02af1 100644 --- a/web/react/components/file_upload_overlay.jsx +++ b/web/react/components/file_upload_overlay.jsx @@ -2,15 +2,15 @@ // See License.txt for license information. module.exports = React.createClass({ - displayName: 'FileUploadOverlay', - render: function() { - return ( - <div className='center-file-overlay invisible'> - <div> - <i className='fa fa-upload'></i> - <span>Drop a file to upload it.</span> - </div> - </div> - ); - } + displayName: 'FileUploadOverlay', + render: function() { + return ( + <div className='file-overlay center-file-overlay invisible'> + <div> + <i className='fa fa-upload'></i> + <span>Drop a file to upload it.</span> + </div> + </div> + ); + } }); |