Commit ed6f4c89 authored by Saturnino Abril's avatar Saturnino Abril

[MM-13760] Allow to close the announcement banner for email and site URL (#2270)

* allow tp close the announcement banner for email and site URL

* update translation IDs
parent fa84bd71
......@@ -4,8 +4,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import {FormattedHTMLMessage, FormattedMessage} from 'react-intl';
import {Link} from 'react-router-dom';
import {FormattedHTMLMessage, FormattedMessage, intlShape} from 'react-intl';
import {isLicenseExpired, isLicenseExpiring, isLicensePastGracePeriod} from 'utils/license_utils.jsx';
import {AnnouncementBarTypes, AnnouncementBarMessages} from 'utils/constants.jsx';
......@@ -16,6 +15,7 @@ import FormattedMarkdownMessage from 'components/formatted_markdown_message';
import AnnouncementBar from './announcement_bar.jsx';
import TextButtonWithSpinner from './text_button_with_spinner.jsx';
import TextDismissableBar from './text_dismissable_bar';
const RENEWAL_LINK = 'https://licensing.mattermost.com/renew';
......@@ -29,6 +29,10 @@ export default class ConfigurationAnnouncementBar extends React.PureComponent {
sendVerificationEmail: PropTypes.func.isRequired,
};
static contextTypes = {
intl: intlShape,
};
handleEmailResend = (email) => {
this.props.sendVerificationEmail(email);
}
......@@ -105,17 +109,21 @@ export default class ConfigurationAnnouncementBar extends React.PureComponent {
}
}
const {formatMessage} = this.context.intl;
if (this.props.config.SendEmailNotifications !== 'true' &&
this.props.config.EnablePreviewModeBanner === 'true') {
this.props.config.EnablePreviewModeBanner === 'true'
) {
const emailMessage = formatMessage({
id: AnnouncementBarMessages.PREVIEW_MODE,
defaultMessage: 'Preview Mode: Email notifications have not been configured',
});
return (
<AnnouncementBar
<TextDismissableBar
allowDismissal={true}
text={emailMessage}
type={AnnouncementBarTypes.ANNOUNCEMENT}
message={
<FormattedMessage
id={AnnouncementBarMessages.PREVIEW_MODE}
defaultMessage='Preview Mode: Email notifications have not been configured'
/>
}
/>
);
}
......@@ -124,44 +132,20 @@ export default class ConfigurationAnnouncementBar extends React.PureComponent {
let id;
let defaultMessage;
if (this.props.config.EnableSignUpWithGitLab === 'true') {
id = t('announcement_bar.error.site_url_gitlab');
defaultMessage = 'Please configure your {docsLink} in the System Console or in gitlab.rb if you\'re using GitLab Mattermost.';
id = t('announcement_bar.error.site_url_gitlab.full');
defaultMessage = 'Please configure your [Site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) in the [System Console](/admin_console/general/configuration) or in gitlab.rb if you\'re using GitLab Mattermost.';
} else {
id = t('announcement_bar.error.site_url');
defaultMessage = 'Please configure your {docsLink} in the System Console.';
id = t('announcement_bar.error.site_url.full');
defaultMessage = 'Please configure your [Site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) in the [System Console](/admin_console/general/configuration).';
}
const siteURLMessage = formatMessage({id, defaultMessage});
return (
<AnnouncementBar
<TextDismissableBar
allowDismissal={true}
text={siteURLMessage}
type={AnnouncementBarTypes.ANNOUNCEMENT}
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='announcement_bar.error.site_url.docsLink'
defaultMessage='Site URL'
/>
</a>
),
link: (
<Link to='/admin_console/general/configuration'>
<FormattedMessage
id='announcement_bar.error.site_url.link'
defaultMessage='the System Console'
/>
</Link>
),
}}
/>
}
/>
);
}
......
......@@ -1366,10 +1366,8 @@
"announcement_bar.error.preview_mode": "Preview Mode: Email notifications have not been configured",
"announcement_bar.error.send_again": "Send again",
"announcement_bar.error.sending": "Sending",
"announcement_bar.error.site_url": "Please configure your {docsLink} in the {link}.",
"announcement_bar.error.site_url_gitlab": "Please configure your {docsLink} in the System Console or in gitlab.rb if you're using GitLab Mattermost.",
"announcement_bar.error.site_url.docsLink": "Site URL",
"announcement_bar.error.site_url.link": "System Console",
"announcement_bar.error.site_url.full": "Please configure your [Site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) in the [System Console](/admin_console/general/configuration).",
"announcement_bar.error.site_url_gitlab.full": "Please configure your [Site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) in the [System Console](/admin_console/general/configuration) or in gitlab.rb if you're using GitLab Mattermost.",
"announcement_bar.notification.email_verified": "Email verified",
"api.channel.add_member.added": "{addedUsername} added to the channel by {username}.",
"api.channel.delete_channel.archived": "{username} archived the channel.",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment