summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-01-25 20:14:27 -0500
committer=Corey Hulen <corey@hulen.com>2016-01-25 20:14:27 -0500
commitd20d6bed06289503301e54bc9bce387df419af4f (patch)
treec2b13a71faab678d97ac3e0c626b9736a7e5e605
parent1701a2cbbe698c96544c275f41d7dbff4b88fd0c (diff)
downloadchat-d20d6bed06289503301e54bc9bce387df419af4f.tar.gz
chat-d20d6bed06289503301e54bc9bce387df419af4f.tar.bz2
chat-d20d6bed06289503301e54bc9bce387df419af4f.zip
PLT-7 fixing error bar msg
-rw-r--r--web/react/components/error_bar.jsx27
-rw-r--r--web/react/pages/channel.jsx5
-rw-r--r--web/static/i18n/en.json3
-rw-r--r--web/static/i18n/es.json3
-rw-r--r--web/templates/head.html7
5 files changed, 36 insertions, 9 deletions
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);
diff --git a/web/react/pages/channel.jsx b/web/react/pages/channel.jsx
index 37c59b75f..331ea3288 100644
--- a/web/react/pages/channel.jsx
+++ b/web/react/pages/channel.jsx
@@ -113,9 +113,4 @@ global.window.setup_channel_page = function setup(props, team, channel) {
<Root map={props} />,
document.getElementById('channel_view')
);
-
- if (global.window.mm_config.SendEmailNotifications === 'false') {
- ErrorStore.storeLastError({message: 'Preview Mode: Email notifications have not been configured'});
- ErrorStore.emitChange();
- }
}; \ No newline at end of file
diff --git a/web/static/i18n/en.json b/web/static/i18n/en.json
index 038b1342d..cb955ee6b 100644
--- a/web/static/i18n/en.json
+++ b/web/static/i18n/en.json
@@ -1,4 +1,5 @@
{
"login.find_teams": "Find your other teams",
- "login.forgot_password": "I forgot my password"
+ "login.forgot_password": "I forgot my password",
+ "error_bar.preview_mode": "Preview Mode: Email notifications have not been configured"
} \ No newline at end of file
diff --git a/web/static/i18n/es.json b/web/static/i18n/es.json
index b849489cb..ade5f585e 100644
--- a/web/static/i18n/es.json
+++ b/web/static/i18n/es.json
@@ -1,4 +1,5 @@
{
"login.find_teams": "Find your other teams (spanish!)",
- "login.forgot_password": "I forgot my password (spanish!)"
+ "login.forgot_password": "I forgot my password (spanish!)",
+ "error_bar.preview_mode": "Preview Mode: Email notifications have not been configured (spanish!)"
} \ No newline at end of file
diff --git a/web/templates/head.html b/web/templates/head.html
index 4060d2410..845cc76e7 100644
--- a/web/templates/head.html
+++ b/web/templates/head.html
@@ -62,8 +62,11 @@
<style id="antiClickjack">body{display:none !important;}</style>
<script>
- ReactIntl.addLocaleData(ReactIntlLocaleData.en);
- ReactIntl.addLocaleData(ReactIntlLocaleData.es);
+ if ('ReactIntl' in window && 'ReactIntlLocaleData' in window) {
+ Object.keys(ReactIntlLocaleData).forEach((lang) => {
+ ReactIntl.addLocaleData(ReactIntlLocaleData[lang]);
+ });
+ }
window.mm_config = {{ .ClientCfg }};
window.mm_license = {{ .ClientLicense }};