From c7bdce8a6641ed8d361a43b6004a351535c78423 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 4 Apr 2017 11:54:52 -0400 Subject: 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 --- webapp/components/error_bar.jsx | 65 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 5 deletions(-) (limited to 'webapp/components/error_bar.jsx') 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 = ( + + + + ), + link: ( + + + + ) + }} + /> + ); } return ( -- cgit v1.2.3-1-g7c22