diff options
Diffstat (limited to 'web/react/components')
-rw-r--r-- | web/react/components/channel_loader.jsx | 14 | ||||
-rw-r--r-- | web/react/components/error_bar.jsx | 16 | ||||
-rw-r--r-- | web/react/components/textbox.jsx | 4 |
3 files changed, 16 insertions, 18 deletions
diff --git a/web/react/components/channel_loader.jsx b/web/react/components/channel_loader.jsx index f3000ee05..e47f2aa50 100644 --- a/web/react/components/channel_loader.jsx +++ b/web/react/components/channel_loader.jsx @@ -6,6 +6,7 @@ AsyncClient with requests. */ import * as AsyncClient from '../utils/async_client.jsx'; +import * as Client from '../utils/client.jsx'; import SocketStore from '../stores/socket_store.jsx'; import ChannelStore from '../stores/channel_store.jsx'; import PostStore from '../stores/post_store.jsx'; @@ -45,6 +46,14 @@ const holders = defineMessages({ wrote: { id: 'channel_loader.wrote', defaultMessage: ' wrote: ' + }, + connectionError: { + id: 'channel_loader.connection_error', + defaultMessage: 'There appears to be a problem with your internet connection.' + }, + unknownError: { + id: 'channel_loader.unknown_error', + defaultMessage: 'We received an unexpected status code from the server.' } }); @@ -67,6 +76,11 @@ class ChannelLoader extends React.Component { wrote: formatMessage(holders.wrote) }); + Client.setTranslations({ + connectionError: formatMessage(holders.connectionError), + unknownError: formatMessage(holders.unknownError) + }); + this.state = {}; } componentDidMount() { diff --git a/web/react/components/error_bar.jsx b/web/react/components/error_bar.jsx index f04185b46..9a114c544 100644 --- a/web/react/components/error_bar.jsx +++ b/web/react/components/error_bar.jsx @@ -38,25 +38,9 @@ export default class ErrorBar extends React.Component { return false; } - if (s.connErrorCount && s.connErrorCount >= 1 && s.connErrorCount < 7) { - return false; - } - return true; } - isConnectionError(s) { - if (!s.connErrorCount || s.connErrorCount === 0) { - return false; - } - - if (s.connErrorCount > 7) { - return true; - } - - return false; - } - componentWillMount() { if (global.window.mm_config.SendEmailNotifications === 'false') { ErrorStore.storeLastError({message: this.props.intl.formatMessage(messages.preview)}); diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx index ec299087d..23ecfb57b 100644 --- a/web/react/components/textbox.jsx +++ b/web/react/components/textbox.jsx @@ -59,9 +59,9 @@ export default class Textbox extends React.Component { } onRecievedError() { - const errorState = ErrorStore.getLastError(); + const errorCount = ErrorStore.getConnectionErrorCount(); - if (errorState && errorState.connErrorCount > 0) { + if (errorCount > 0) { this.setState({connection: 'bad-connection'}); } else { this.setState({connection: ''}); |