Merge pull request #2276 from mattermost/PLT-2030

PLT-2030 fixing error handling
Этот коммит содержится в:
Christopher Speller
2016-03-01 08:27:57 -05:00
родитель 39c83f70fc 6c18e13f8a
Коммит a66e9513ad
7 изменённых файлов: 58 добавлений и 42 удалений

Просмотреть файл

@@ -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() {

Просмотреть файл

@@ -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)});

Просмотреть файл

@@ -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: ''});