diff options
author | =Corey Hulen <corey@hulen.com> | 2016-02-01 14:44:17 -0800 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-02-01 14:44:17 -0800 |
commit | b4ec6900510077253290e361d1a706e5368a45de (patch) | |
tree | 6fc7c131fa7aa5f32e3aba8102416aa23c65963d /web/react/components/error_bar.jsx | |
parent | ea71731f838fc010cfc7511c09875184d1b2396b (diff) | |
parent | f28486c4553f7f4bccf7bf69153c2f12699705f9 (diff) | |
download | chat-b4ec6900510077253290e361d1a706e5368a45de.tar.gz chat-b4ec6900510077253290e361d1a706e5368a45de.tar.bz2 chat-b4ec6900510077253290e361d1a706e5368a45de.zip |
Fixing merge
Diffstat (limited to 'web/react/components/error_bar.jsx')
-rw-r--r-- | web/react/components/error_bar.jsx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/web/react/components/error_bar.jsx b/web/react/components/error_bar.jsx index 921e8afe1..f04185b46 100644 --- a/web/react/components/error_bar.jsx +++ b/web/react/components/error_bar.jsx @@ -3,6 +3,16 @@ import ErrorStore from '../stores/error_store.jsx'; +// import mm-intl is required for the tool to be able to extract the messages +import {defineMessages} from 'mm-intl'; + +var messages = defineMessages({ + preview: { + id: 'error_bar.preview_mode', + defaultMessage: 'Preview Mode: Email notifications have not been configured' + } +}); + export default class ErrorBar extends React.Component { constructor() { super(); @@ -13,6 +23,12 @@ export default class ErrorBar extends React.Component { this.state = ErrorStore.getLastError(); } + static propTypes() { + return { + intl: ReactIntl.intlShape.isRequired + }; + } + isValidError(s) { if (!s) { return false; @@ -41,6 +57,13 @@ export default class ErrorBar extends React.Component { return false; } + componentWillMount() { + if (global.window.mm_config.SendEmailNotifications === 'false') { + ErrorStore.storeLastError({message: this.props.intl.formatMessage(messages.preview)}); + this.onErrorChange(); + } + } + componentDidMount() { ErrorStore.addChangeListener(this.onErrorChange); } @@ -64,6 +87,7 @@ export default class ErrorBar extends React.Component { e.preventDefault(); } + ErrorStore.clearLastError(); this.setState({message: null}); } @@ -86,3 +110,5 @@ export default class ErrorBar extends React.Component { ); } } + +export default ReactIntl.injectIntl(ErrorBar); |