summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-04-04 11:54:52 -0400
committerJoram Wilander <jwawilander@gmail.com>2017-04-04 11:54:52 -0400
commitc7bdce8a6641ed8d361a43b6004a351535c78423 (patch)
treef42d32d8a4d0cd4f702644dcb6a594f905f3f771 /webapp
parent3a79e451ffe3ffe618311ee15b02dbebde6a77b0 (diff)
downloadchat-c7bdce8a6641ed8d361a43b6004a351535c78423.tar.gz
chat-c7bdce8a6641ed8d361a43b6004a351535c78423.tar.bz2
chat-c7bdce8a6641ed8d361a43b6004a351535c78423.zip
PLT-5900 Removed automatic configuration of SiteURL (#5952)
* Revert "PLT-5765 Passed SiteURL to SendNotifications (#5705)" This reverts commit a8e68bd8905972ae59de90fa33d5b3e3c274dc47. * Removed automatic configuration of SiteURL * Reverted unintentional config changes * Updated help text * Added link to docs in Site URL warning * Fixed merge conflict
Diffstat (limited to 'webapp')
-rw-r--r--webapp/components/admin_console/admin_settings.jsx8
-rw-r--r--webapp/components/admin_console/configuration_settings.jsx26
-rw-r--r--webapp/components/error_bar.jsx65
-rwxr-xr-xwebapp/i18n/en.json6
-rw-r--r--webapp/stores/error_store.jsx4
5 files changed, 94 insertions, 15 deletions
diff --git a/webapp/components/admin_console/admin_settings.jsx b/webapp/components/admin_console/admin_settings.jsx
index 30b9cbd11..ffb10d9ec 100644
--- a/webapp/components/admin_console/admin_settings.jsx
+++ b/webapp/components/admin_console/admin_settings.jsx
@@ -69,6 +69,10 @@ export default class AdminSettings extends React.Component {
if (callback) {
callback();
}
+
+ if (this.handleSaved) {
+ this.handleSaved(config);
+ }
},
(err) => {
this.setState({
@@ -79,6 +83,10 @@ export default class AdminSettings extends React.Component {
if (callback) {
callback();
}
+
+ if (this.handleSaved) {
+ this.handleSaved(config);
+ }
}
);
}
diff --git a/webapp/components/admin_console/configuration_settings.jsx b/webapp/components/admin_console/configuration_settings.jsx
index ec5606fa1..16ebf1952 100644
--- a/webapp/components/admin_console/configuration_settings.jsx
+++ b/webapp/components/admin_console/configuration_settings.jsx
@@ -2,18 +2,20 @@
// See License.txt for license information.
import React from 'react';
+import {FormattedMessage} from 'react-intl';
+
+import ErrorStore from 'stores/error_store.jsx';
import * as Utils from 'utils/utils.jsx';
import AdminSettings from './admin_settings.jsx';
-import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
+import BooleanSetting from './boolean_setting.jsx';
+import {ConnectionSecurityDropdownSettingWebserver} from './connection_security_dropdown_setting.jsx';
+import PurgeCachesButton from './purge_caches.jsx';
+import ReloadConfigButton from './reload_config.jsx';
import SettingsGroup from './settings_group.jsx';
import TextSetting from './text_setting.jsx';
-import ReloadConfigButton from './reload_config.jsx';
-import PurgeCachesButton from './purge_caches.jsx';
import WebserverModeDropdownSetting from './webserver_mode_dropdown_setting.jsx';
-import {ConnectionSecurityDropdownSettingWebserver} from './connection_security_dropdown_setting.jsx';
-import BooleanSetting from './boolean_setting.jsx';
export default class ConfigurationSettings extends AdminSettings {
constructor(props) {
@@ -21,6 +23,8 @@ export default class ConfigurationSettings extends AdminSettings {
this.getConfigFromState = this.getConfigFromState.bind(this);
+ this.handleSaved = this.handleSaved.bind(this);
+
this.renderSettings = this.renderSettings.bind(this);
}
@@ -62,6 +66,14 @@ export default class ConfigurationSettings extends AdminSettings {
};
}
+ handleSaved(newConfig) {
+ const lastError = ErrorStore.getLastError();
+
+ if (lastError && lastError.message === 'error_bar.site_url' && newConfig.ServiceSettings.SiteURL) {
+ ErrorStore.clearLastError(true);
+ }
+ }
+
renderTitle() {
return (
<FormattedMessage
@@ -92,9 +104,9 @@ export default class ConfigurationSettings extends AdminSettings {
}
placeholder={Utils.localizeMessage('admin.service.siteURLExample', 'Ex "https://mattermost.example.com:1234"')}
helpText={
- <FormattedHTMLMessage
+ <FormattedMessage
id='admin.service.siteURLDescription'
- defaultMessage='The URL, including port number and protocol, that users will use to access Mattermost. This field can be left blank unless you are configuring email batching in <b>Notifications > Email</b>. When blank, the URL is automatically configured based on incoming traffic.'
+ defaultMessage='The URL, including port number and protocol, that users will use to access Mattermost. This setting is required.'
/>
}
value={this.state.siteURL}
diff --git a/webapp/components/error_bar.jsx b/webapp/components/error_bar.jsx
index edb929f20..146b4955e 100644
--- a/webapp/components/error_bar.jsx
+++ b/webapp/components/error_bar.jsx
@@ -13,11 +13,13 @@ const StatTypes = Constants.StatTypes;
import React from 'react';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
+import {Link} from 'react-router';
const EXPIRING_ERROR = 'error_bar.expiring';
const EXPIRED_ERROR = 'error_bar.expired';
const PAST_GRACE_ERROR = 'error_bar.past_grace';
const RENEWAL_LINK = 'https://licensing.mattermost.com/renew';
+const SITE_URL_ERROR = 'error_bar.site_url';
const BAR_DEVELOPER_TYPE = 'developer';
const BAR_CRITICAL_TYPE = 'critical';
@@ -32,15 +34,31 @@ export default class ErrorBar extends React.Component {
ErrorStore.clearLastError();
+ this.setInitialError();
+
+ this.state = ErrorStore.getLastError();
+ }
+
+ setInitialError() {
let isSystemAdmin = false;
const user = UserStore.getCurrentUser();
if (user) {
isSystemAdmin = Utils.isSystemAdmin(user.roles);
}
- if (!ErrorStore.getIgnoreNotification() && global.window.mm_config.SendEmailNotifications === 'false') {
- ErrorStore.storeLastError({notification: true, message: Utils.localizeMessage('error_bar.preview_mode', 'Preview Mode: Email notifications have not been configured')});
- } else if (isLicensePastGracePeriod()) {
+ const errorIgnored = ErrorStore.getIgnoreNotification();
+
+ if (!errorIgnored) {
+ if (global.mm_config.SendEmailNotifications === 'false') {
+ ErrorStore.storeLastError({notification: true, message: Utils.localizeMessage('error_bar.preview_mode', 'Preview Mode: Email notifications have not been configured')});
+ return;
+ } else if (isSystemAdmin && global.mm_config.SiteURL === '') {
+ ErrorStore.storeLastError({notification: true, message: SITE_URL_ERROR});
+ return;
+ }
+ }
+
+ if (isLicensePastGracePeriod()) {
if (isSystemAdmin) {
ErrorStore.storeLastError({notification: true, message: EXPIRED_ERROR, type: BAR_CRITICAL_TYPE});
} else {
@@ -51,8 +69,6 @@ export default class ErrorBar extends React.Component {
} else if (isLicenseExpiring() && isSystemAdmin) {
ErrorStore.storeLastError({notification: true, message: EXPIRING_ERROR});
}
-
- this.state = ErrorStore.getLastError();
}
isValidError(s) {
@@ -157,6 +173,45 @@ export default class ErrorBar extends React.Component {
defaultMessage='Enterprise license is expired and some features may be disabled. Please contact your System Administrator for details.'
/>
);
+ } else if (message === SITE_URL_ERROR) {
+ let id;
+ let defaultMessage;
+ if (global.mm_config.EnableSignUpWithGitLab === 'true') {
+ id = 'error_bar.site_url_gitlab';
+ defaultMessage = '{docsLink} is now a required setting. Please configure it in the System Console or in gitlab.rb if you\'re using GitLab Mattermost.';
+ } else {
+ id = 'error_bar.site_url';
+ defaultMessage = '{docsLink} is now a required setting. Please configure it in {link}.';
+ }
+
+ message = (
+ <FormattedMessage
+ id={id}
+ defaultMessage={defaultMessage}
+ values={{
+ docsLink: (
+ <a
+ href='https://docs.mattermost.com/administration/config-settings.html#site-url'
+ rel='noopener noreferrer'
+ target='_blank'
+ >
+ <FormattedMessage
+ id='error_bar.site_url.docsLink'
+ defaultMessage='Site URL'
+ />
+ </a>
+ ),
+ link: (
+ <Link to='/admin_console/general/configuration'>
+ <FormattedMessage
+ id='error_bar.site_url.link'
+ defaultMessage='the System Console'
+ />
+ </Link>
+ )
+ }}
+ />
+ );
}
return (
diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json
index ae902e3f8..448cb436d 100755
--- a/webapp/i18n/en.json
+++ b/webapp/i18n/en.json
@@ -725,7 +725,7 @@
"admin.service.sessionCacheDesc": "The number of minutes to cache a session in memory.",
"admin.service.sessionDaysEx": "E.g.: \"30\"",
"admin.service.siteURL": "Site URL:",
- "admin.service.siteURLDescription": "The URL, including port number and protocol, that users will use to access Mattermost. This field can be left blank unless you are configuring email batching in <b>Notifications > Email</b>. When blank, the URL is automatically configured based on incoming traffic.",
+ "admin.service.siteURLDescription": "The URL, including port number and protocol, that users will use to access Mattermost. This setting is required.",
"admin.service.siteURLExample": "E.g.: \"https://mattermost.example.com:1234\"",
"admin.service.ssoSessionDays": "Session length SSO (days):",
"admin.service.ssoSessionDaysDesc": "The number of days from the last time a user entered their credentials to the expiry of the user's session. If the authentication method is SAML or GitLab, the user may automatically be logged back in to Mattermost if they are already logged in to SAML or GitLab. After changing this setting, the setting will take effect after the next time the user enters their credentials.",
@@ -1310,6 +1310,10 @@
"error_bar.expiring": "Enterprise license expires on {date}. <a href='{link}' target='_blank'>Please renew.</a>",
"error_bar.past_grace": "Enterprise license is expired and some features may be disabled. Please contact your System Administrator for details.",
"error_bar.preview_mode": "Preview Mode: Email notifications have not been configured",
+ "error_bar.site_url": "{docsLink} is now a required setting. Please configure it in {link}.",
+ "error_bar.site_url.docsLink": "Site URL",
+ "error_bar.site_url.link": "the System Console",
+ "error_bar.site_url_gitlab": "{docsLink} is now a required setting. Please configure it in the System Console or in gitlab.rb if you're using GitLab Mattermost.",
"file_attachment.download": "Download",
"file_info_preview.size": "Size ",
"file_info_preview.type": "File type ",
diff --git a/webapp/stores/error_store.jsx b/webapp/stores/error_store.jsx
index e37de40ac..3b0bb023f 100644
--- a/webapp/stores/error_store.jsx
+++ b/webapp/stores/error_store.jsx
@@ -62,11 +62,11 @@ class ErrorStoreClass extends EventEmitter {
BrowserStore.setGlobalItem('last_error_conn', count);
}
- clearLastError() {
+ clearLastError(force) {
var lastError = this.getLastError();
// preview message can only be cleared by clearNotificationError
- if (lastError && lastError.notification) {
+ if (!force && lastError && lastError.notification) {
return;
}