diff options
author | Jonathan <jonfritz@gmail.com> | 2017-08-05 19:52:35 -0400 |
---|---|---|
committer | Saturnino Abril <saturnino.abril@gmail.com> | 2017-08-06 07:52:35 +0800 |
commit | 178ccd16cba26144eac404f413440867b360033c (patch) | |
tree | 5a2304ee8fbe7586d4101b7e38cd85756e114a05 /webapp/components | |
parent | 9f3713aa98011596a62315fd3b96fa2e77044081 (diff) | |
download | chat-178ccd16cba26144eac404f413440867b360033c.tar.gz chat-178ccd16cba26144eac404f413440867b360033c.tar.bz2 chat-178ccd16cba26144eac404f413440867b360033c.zip |
System Console: Email notification content setting (#7122)
* PLT-7195: Added new config option, new license feature, and config UI to system console. Still need to implement behaviour change in email batching code
* PLT-7195: Modified batch emails to respect email notification content type setting
* PLT-7195: Tweaking the colours a bit
* PLT-7195: Added support for email notification content type setting in immediate (non-batched) notification messages. Attempted to clean up the code somewhat. Unit tests coming in a future commit
* PLT-7195: Added unit tests for non-batched emails
* Checked license when applying email content settings
* Changed return type of getFormattedPostTime
Diffstat (limited to 'webapp/components')
-rw-r--r-- | webapp/components/admin_console/email_settings.jsx | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/webapp/components/admin_console/email_settings.jsx b/webapp/components/admin_console/email_settings.jsx index e48bc46ab..e630402bc 100644 --- a/webapp/components/admin_console/email_settings.jsx +++ b/webapp/components/admin_console/email_settings.jsx @@ -11,11 +11,15 @@ import * as Utils from 'utils/utils.jsx'; import AdminSettings from './admin_settings.jsx'; import BooleanSetting from './boolean_setting.jsx'; import {ConnectionSecurityDropdownSettingEmail} from './connection_security_dropdown_setting.jsx'; +import DropdownSetting from './dropdown_setting.jsx'; import EmailConnectionTest from './email_connection_test.jsx'; import {FormattedHTMLMessage, FormattedMessage} from 'react-intl'; import SettingsGroup from './settings_group.jsx'; import TextSetting from './text_setting.jsx'; +const EMAIL_NOTIFICATION_CONTENTS_FULL = 'full'; +const EMAIL_NOTIFICATION_CONTENTS_GENERIC = 'generic'; + export default class EmailSettings extends AdminSettings { constructor(props) { super(props); @@ -39,6 +43,7 @@ export default class EmailSettings extends AdminSettings { config.EmailSettings.EnableEmailBatching = this.state.enableEmailBatching; config.ServiceSettings.EnableSecurityFixAlert = this.state.enableSecurityFixAlert; config.EmailSettings.SkipServerCertificateVerification = this.state.skipServerCertificateVerification; + config.EmailSettings.EmailNotificationContentsType = this.state.emailNotificationContentsType; return config; } @@ -63,7 +68,8 @@ export default class EmailSettings extends AdminSettings { connectionSecurity: config.EmailSettings.ConnectionSecurity, enableEmailBatching: config.EmailSettings.EnableEmailBatching, skipServerCertificateVerification: config.EmailSettings.SkipServerCertificateVerification, - enableSecurityFixAlert: config.ServiceSettings.EnableSecurityFixAlert + enableSecurityFixAlert: config.ServiceSettings.EnableSecurityFixAlert, + emailNotificationContentsType: config.EmailSettings.EmailNotificationContentsType }; } @@ -105,6 +111,48 @@ export default class EmailSettings extends AdminSettings { ); } + let emailNotificationContentsTypeDropdown = null; + let emailNotificationContentsHelpText = null; + if (window.mm_license.EmailNotificationContents === 'true') { + const emailNotificationContentsTypes = []; + emailNotificationContentsTypes.push({value: EMAIL_NOTIFICATION_CONTENTS_FULL, text: Utils.localizeMessage('admin.email.notification.contents.full', 'Send full message contents')}); + emailNotificationContentsTypes.push({value: EMAIL_NOTIFICATION_CONTENTS_GENERIC, text: Utils.localizeMessage('admin.email.notification.contents.generic', 'Send generic description with only sender name')}); + + if (this.state.emailNotificationContentsType === EMAIL_NOTIFICATION_CONTENTS_FULL) { + emailNotificationContentsHelpText = ( + <FormattedHTMLMessage + key='admin.email.notification.contents.full.description' + id='admin.email.notification.contents.full.description' + defaultMessage='Sender name and channel are included in email notifications.</br>Typically used for compliance reasons if Mattermost contains confidential information and policy dictates it cannot be stored in email.' + /> + ); + } else if (this.state.emailNotificationContentsType === EMAIL_NOTIFICATION_CONTENTS_GENERIC) { + emailNotificationContentsHelpText = ( + <FormattedHTMLMessage + key='admin.email.notification.contents.generic.description' + id='admin.email.notification.contents.generic.description' + defaultMessage='Only the name of the person who sent the message, with no information about channel name or message contents are included in email notifications.</br>Typically used for compliance reasons if Mattermost contains confidential information and policy dictates it cannot be stored in email.' + /> + ); + } + + emailNotificationContentsTypeDropdown = ( + <DropdownSetting + id='emailNotificationContentsType' + values={emailNotificationContentsTypes} + label={ + <FormattedMessage + id='admin.email.notification.contents.title' + defaultMessage='Email Notification Contents: ' + /> + } + value={this.state.emailNotificationContentsType} + onChange={this.handleChange} + helpText={emailNotificationContentsHelpText} + /> + ); + } + return ( <SettingsGroup> <BooleanSetting @@ -144,6 +192,7 @@ export default class EmailSettings extends AdminSettings { onChange={this.handleChange} disabled={!this.state.sendEmailNotifications || this.props.config.ClusterSettings.Enable || !this.props.config.ServiceSettings.SiteURL} /> + {emailNotificationContentsTypeDropdown} <TextSetting id='feedbackName' label={ |