From 734387bdb9c732fc4c91e57c8a59a18db493224f Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
Date: Mon, 7 Mar 2016 11:11:08 -0500
Subject: Stopped calling uploadFiles multiple times for a single upload

---
 web/react/components/create_post.jsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'web/react/components/create_post.jsx')

diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx
index 9d7a19554..48d28ad6a 100644
--- a/web/react/components/create_post.jsx
+++ b/web/react/components/create_post.jsx
@@ -262,9 +262,7 @@ class CreatePost extends React.Component {
             message = err.message;
         }
 
-        if (clientId === -1) {
-            this.setState({serverError: message});
-        } else {
+        if (clientId !== -1) {
             const draft = PostStore.getDraft(this.state.channelId);
 
             const index = draft.uploadsInProgress.indexOf(clientId);
@@ -274,8 +272,10 @@ class CreatePost extends React.Component {
 
             PostStore.storeDraft(this.state.channelId, draft);
 
-            this.setState({uploadsInProgress: draft.uploadsInProgress, serverError: message});
+            this.setState({uploadsInProgress: draft.uploadsInProgress});
         }
+
+        this.setState({serverError: message});
     }
     removePreview(id) {
         const previews = Object.assign([], this.state.previews);
-- 
cgit v1.2.3-1-g7c22

