summaryrefslogtreecommitdiffstats
path: root/web/react/components/create_post.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_post.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_post.jsx')
-rw-r--r--web/react/components/create_post.jsx18
1 files changed, 11 insertions, 7 deletions
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;