From d20d6bed06289503301e54bc9bce387df419af4f Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Mon, 25 Jan 2016 20:14:27 -0500 Subject: PLT-7 fixing error bar msg --- web/react/components/error_bar.jsx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'web/react/components/error_bar.jsx') diff --git a/web/react/components/error_bar.jsx b/web/react/components/error_bar.jsx index 921e8afe1..36ab1438a 100644 --- a/web/react/components/error_bar.jsx +++ b/web/react/components/error_bar.jsx @@ -3,6 +3,17 @@ import ErrorStore from '../stores/error_store.jsx'; +var intlShape = ReactIntl.intlShape; +var injectIntl = ReactIntl.injectIntl; +var defineMessages = ReactIntl.defineMessages; + +const messages = defineMessages({ + previewMode: { + 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 +24,12 @@ export default class ErrorBar extends React.Component { this.state = ErrorStore.getLastError(); } + static propTypes() { + return { + intl: intlShape.isRequired + }; + } + isValidError(s) { if (!s) { return false; @@ -41,6 +58,14 @@ export default class ErrorBar extends React.Component { return false; } + componentWillMount() { + const {formatMessage} = this.props.intl; + if (global.window.mm_config.SendEmailNotifications === 'false') { + ErrorStore.storeLastError({message: formatMessage(messages.previewMode)}); + this.onErrorChange(); + } + } + componentDidMount() { ErrorStore.addChangeListener(this.onErrorChange); } @@ -86,3 +111,5 @@ export default class ErrorBar extends React.Component { ); } } + +export default injectIntl(ErrorBar); -- cgit v1.2.3-1-g7c22 From 6bb5d98229ef84d957a2dca1466295d30356ec87 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Mon, 25 Jan 2016 20:28:18 -0500 Subject: Cleaning up a little --- web/react/components/error_bar.jsx | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'web/react/components/error_bar.jsx') diff --git a/web/react/components/error_bar.jsx b/web/react/components/error_bar.jsx index 36ab1438a..279e0c315 100644 --- a/web/react/components/error_bar.jsx +++ b/web/react/components/error_bar.jsx @@ -3,17 +3,6 @@ import ErrorStore from '../stores/error_store.jsx'; -var intlShape = ReactIntl.intlShape; -var injectIntl = ReactIntl.injectIntl; -var defineMessages = ReactIntl.defineMessages; - -const messages = defineMessages({ - previewMode: { - id: 'error_bar.preview_mode', - defaultMessage: 'Preview Mode: Email notifications have not been configured' - } -}); - export default class ErrorBar extends React.Component { constructor() { super(); @@ -26,7 +15,7 @@ export default class ErrorBar extends React.Component { static propTypes() { return { - intl: intlShape.isRequired + intl: ReactIntl.intlShape.isRequired }; } @@ -59,9 +48,8 @@ export default class ErrorBar extends React.Component { } componentWillMount() { - const {formatMessage} = this.props.intl; if (global.window.mm_config.SendEmailNotifications === 'false') { - ErrorStore.storeLastError({message: formatMessage(messages.previewMode)}); + ErrorStore.storeLastError({message: this.props.intl.formatMessage({id: 'error_bar.preview_mode'})}); this.onErrorChange(); } } @@ -112,4 +100,4 @@ export default class ErrorBar extends React.Component { } } -export default injectIntl(ErrorBar); +export default ReactIntl.injectIntl(ErrorBar); -- cgit v1.2.3-1-g7c22 From 4f8e46ddd554573a4ae26ef7a18616064d6166aa Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Mon, 25 Jan 2016 20:32:14 -0500 Subject: Cleaning up --- web/react/components/error_bar.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'web/react/components/error_bar.jsx') diff --git a/web/react/components/error_bar.jsx b/web/react/components/error_bar.jsx index 279e0c315..3362ab835 100644 --- a/web/react/components/error_bar.jsx +++ b/web/react/components/error_bar.jsx @@ -49,7 +49,11 @@ export default class ErrorBar extends React.Component { componentWillMount() { if (global.window.mm_config.SendEmailNotifications === 'false') { - ErrorStore.storeLastError({message: this.props.intl.formatMessage({id: 'error_bar.preview_mode'})}); + ErrorStore.storeLastError({message: this.props.intl.formatMessage( + { + id: 'error_bar.preview_mode', + defaultMessage: 'Preview Mode: Email notifications have not been configured' + })}); this.onErrorChange(); } } -- cgit v1.2.3-1-g7c22 From 64247fd18c915bda5a2c00e61f0880f153e76235 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Mon, 25 Jan 2016 20:33:28 -0500 Subject: Cleaning up --- web/react/components/error_bar.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'web/react/components/error_bar.jsx') diff --git a/web/react/components/error_bar.jsx b/web/react/components/error_bar.jsx index 3362ab835..e93545c25 100644 --- a/web/react/components/error_bar.jsx +++ b/web/react/components/error_bar.jsx @@ -53,7 +53,8 @@ export default class ErrorBar extends React.Component { { id: 'error_bar.preview_mode', defaultMessage: 'Preview Mode: Email notifications have not been configured' - })}); + } + )}); this.onErrorChange(); } } -- cgit v1.2.3-1-g7c22