summaryrefslogtreecommitdiffstats
path: root/web/react/components/create_comment.jsx
diff options
context:
space:
mode:
authorReed Garmsen <rgarmsen2295@gmail.com>2015-08-13 15:44:38 -0700
committerReed Garmsen <rgarmsen2295@gmail.com>2015-08-13 15:47:50 -0700
commit6f68c508ee3fd8c54fc1ba314cc60bae3f0b2600 (patch)
tree02fa8f15c65239f7b0a326fabdfa9713bbac0b9f /web/react/components/create_comment.jsx
parent912ca8e8dd2f69d8a15429f3ab4bbb7ac178ab8a (diff)
downloadchat-6f68c508ee3fd8c54fc1ba314cc60bae3f0b2600.tar.gz
chat-6f68c508ee3fd8c54fc1ba314cc60bae3f0b2600.tar.bz2
chat-6f68c508ee3fd8c54fc1ba314cc60bae3f0b2600.zip
Better error checking along with other fixes
Diffstat (limited to 'web/react/components/create_comment.jsx')
-rw-r--r--web/react/components/create_comment.jsx18
1 files changed, 11 insertions, 7 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: []});