From 4345dce3b8c623a79b7d5c14bf67bc1a3c1633ed Mon Sep 17 00:00:00 2001
From: =Corey Hulen <corey@hulen.com>
Date: Tue, 6 Oct 2015 16:17:27 -0700
Subject: PLT-500 fixing connection msg issues

---
 web/react/utils/client.jsx | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

(limited to 'web/react/utils/client.jsx')

diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index d9f486009..6dccfcdeb 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -2,6 +2,7 @@
 
 var BrowserStore = require('../stores/browser_store.jsx');
 var TeamStore = require('../stores/team_store.jsx');
+var ErrorStore = require('../stores/error_store.jsx');
 
 export function track(category, action, label, prop, val) {
     global.window.analytics.track(action, {category: category, label: label, property: prop, value: val});
@@ -27,7 +28,16 @@ function handleError(methodName, xhr, status, err) {
         msg = 'error in ' + methodName + ' status=' + status + ' statusCode=' + xhr.status + ' err=' + err;
 
         if (xhr.status === 0) {
-            e = {message: 'There appears to be a problem with your internet connection', connErrorCount: 1};
+            let errorCount = 1;
+            const oldError = ErrorStore.getLastError();
+            let connectError = 'There appears to be a problem with your internet connection';
+
+            if (oldError && oldError.connErrorCount) {
+                errorCount += oldError.connErrorCount;
+                connectError = 'We cannot reach the Mattermost service.  The service may be down or misconfigured.  Please contact an administrator to make sure the WebSocket port is configured properly.';
+            }
+
+            e = {message: connectError, connErrorCount: errorCount};
         } else {
             e = {message: 'We received an unexpected status code from the server (' + xhr.status + ')'};
         }
-- 
cgit v1.2.3-1-g7c22

