diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-08-10 12:05:45 -0400 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-08-10 14:04:23 -0400 |
commit | c9a1bf2d336cc5718cdf327f37cfdf87dc0e2705 (patch) | |
tree | d90cdfebf96ac6a4557a8caaefe06888b7d9d6ba /web/react/components/file_preview.jsx | |
parent | 4b74c873cc95973c5434988a41f5e06446a4e586 (diff) | |
download | chat-c9a1bf2d336cc5718cdf327f37cfdf87dc0e2705.tar.gz chat-c9a1bf2d336cc5718cdf327f37cfdf87dc0e2705.tar.bz2 chat-c9a1bf2d336cc5718cdf327f37cfdf87dc0e2705.zip |
Changed post drafts to maintain a store a unique id for each file upload to fix issues with duplicate file names
Diffstat (limited to 'web/react/components/file_preview.jsx')
-rw-r--r-- | web/react/components/file_preview.jsx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/web/react/components/file_preview.jsx b/web/react/components/file_preview.jsx index 8218429fd..d1b2f734a 100644 --- a/web/react/components/file_preview.jsx +++ b/web/react/components/file_preview.jsx @@ -10,7 +10,12 @@ var Constants = require('../utils/constants.jsx'); module.exports = React.createClass({ handleRemove: function(e) { var previewDiv = e.target.parentNode.parentNode; - this.props.onRemove(previewDiv.getAttribute('data-filename')); + + if (previewDiv.hasAttribute('data-filename')) { + this.props.onRemove(previewDiv.getAttribute('data-filename')); + } else if (previewDiv.hasAttribute('data-client-id')) { + this.props.onRemove(previewDiv.getAttribute('data-client-id')); + } }, render: function() { var previews = []; @@ -43,9 +48,9 @@ module.exports = React.createClass({ } }.bind(this)); - this.props.uploadsInProgress.forEach(function(filename) { + this.props.uploadsInProgress.forEach(function(clientId) { previews.push( - <div className="preview-div" data-filename={filename}> + <div className="preview-div" data-client-id={clientId}> <img className="spinner" src="/static/images/load.gif"/> <a className="remove-preview" onClick={this.handleRemove}><i className="glyphicon glyphicon-remove"/></a> </div> |