PLT-3168 Hide EnableFormatting advanced setting unless testing is enabled (#3237)
* Added EnableTesting to the client config * Hid EnableFormatting advanced setting unless testing is enabled
Этот коммит содержится в:
коммит произвёл
enahum
родитель
96373a0cc7
Коммит
2965a00e9b
@@ -217,6 +217,7 @@ func getClientConfig(c *model.Config) map[string]string {
|
|||||||
props["EnableOnlyAdminIntegrations"] = strconv.FormatBool(*c.ServiceSettings.EnableOnlyAdminIntegrations)
|
props["EnableOnlyAdminIntegrations"] = strconv.FormatBool(*c.ServiceSettings.EnableOnlyAdminIntegrations)
|
||||||
props["EnablePostUsernameOverride"] = strconv.FormatBool(c.ServiceSettings.EnablePostUsernameOverride)
|
props["EnablePostUsernameOverride"] = strconv.FormatBool(c.ServiceSettings.EnablePostUsernameOverride)
|
||||||
props["EnablePostIconOverride"] = strconv.FormatBool(c.ServiceSettings.EnablePostIconOverride)
|
props["EnablePostIconOverride"] = strconv.FormatBool(c.ServiceSettings.EnablePostIconOverride)
|
||||||
|
props["EnableTesting"] = strconv.FormatBool(c.ServiceSettings.EnableTesting)
|
||||||
props["EnableDeveloper"] = strconv.FormatBool(*c.ServiceSettings.EnableDeveloper)
|
props["EnableDeveloper"] = strconv.FormatBool(*c.ServiceSettings.EnableDeveloper)
|
||||||
|
|
||||||
props["SendEmailNotifications"] = strconv.FormatBool(c.EmailSettings.SendEmailNotifications)
|
props["SendEmailNotifications"] = strconv.FormatBool(c.EmailSettings.SendEmailNotifications)
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ export default class AdvancedSettingsDisplay extends React.Component {
|
|||||||
this.toggleFeature = this.toggleFeature.bind(this);
|
this.toggleFeature = this.toggleFeature.bind(this);
|
||||||
this.saveEnabledFeatures = this.saveEnabledFeatures.bind(this);
|
this.saveEnabledFeatures = this.saveEnabledFeatures.bind(this);
|
||||||
|
|
||||||
|
this.renderFormattingSection = this.renderFormattingSection.bind(this);
|
||||||
|
|
||||||
const preReleaseFeaturesKeys = Object.keys(PreReleaseFeatures);
|
const preReleaseFeaturesKeys = Object.keys(PreReleaseFeatures);
|
||||||
const advancedSettings = PreferenceStore.getCategory(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS);
|
const advancedSettings = PreferenceStore.getCategory(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS);
|
||||||
const settings = {
|
const settings = {
|
||||||
@@ -137,6 +139,85 @@ export default class AdvancedSettingsDisplay extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderFormattingSection() {
|
||||||
|
if (window.mm_config.EnableTesting === 'false') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.props.activeSection === 'formatting') {
|
||||||
|
return (
|
||||||
|
<SettingItemMax
|
||||||
|
title={
|
||||||
|
<FormattedMessage
|
||||||
|
id='user.settings.advance.formattingTitle'
|
||||||
|
defaultMessage='Enable Post Formatting'
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
inputs={
|
||||||
|
<div>
|
||||||
|
<div className='radio'>
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
type='radio'
|
||||||
|
name='formatting'
|
||||||
|
checked={this.state.settings.formatting !== 'false'}
|
||||||
|
onChange={this.updateSetting.bind(this, 'formatting', 'true')}
|
||||||
|
/>
|
||||||
|
<FormattedMessage
|
||||||
|
id='user.settings.advance.on'
|
||||||
|
defaultMessage='On'
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<br/>
|
||||||
|
</div>
|
||||||
|
<div className='radio'>
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
type='radio'
|
||||||
|
name='formatting'
|
||||||
|
checked={this.state.settings.formatting === 'false'}
|
||||||
|
onChange={this.updateSetting.bind(this, 'formatting', 'false')}
|
||||||
|
/>
|
||||||
|
<FormattedMessage
|
||||||
|
id='user.settings.advance.off'
|
||||||
|
defaultMessage='Off'
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<br/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<br/>
|
||||||
|
<FormattedMessage
|
||||||
|
id='user.settings.advance.formattingDesc'
|
||||||
|
defaultMessage='If enabled, posts will be formatted to create links, show emoji, style the text, and add line breaks. By default, this setting is enabled. Changing this setting requires the page to be refreshed.'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
submit={() => this.handleSubmit('formatting')}
|
||||||
|
server_error={this.state.serverError}
|
||||||
|
updateSection={(e) => {
|
||||||
|
this.updateSection('');
|
||||||
|
e.preventDefault();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SettingItemMin
|
||||||
|
title={
|
||||||
|
<FormattedMessage
|
||||||
|
id='user.settings.advance.formattingTitle'
|
||||||
|
defaultMessage='Enable Post Formatting'
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
describe={this.renderOnOffLabel(this.state.settings.formatting)}
|
||||||
|
updateSection={() => this.props.updateSection('formatting')}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
renderFeatureLabel(feature) {
|
renderFeatureLabel(feature) {
|
||||||
switch (feature) {
|
switch (feature) {
|
||||||
case 'MARKDOWN_PREVIEW':
|
case 'MARKDOWN_PREVIEW':
|
||||||
@@ -248,78 +329,10 @@ export default class AdvancedSettingsDisplay extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let formattingSection;
|
const formattingSection = this.renderFormattingSection();
|
||||||
if (this.props.activeSection === 'formatting') {
|
let formattingSectionDivider = null;
|
||||||
formattingSection = (
|
if (formattingSection) {
|
||||||
<SettingItemMax
|
formattingSectionDivider = <div className='divider-light'/>;
|
||||||
title={
|
|
||||||
<FormattedMessage
|
|
||||||
id='user.settings.advance.formattingTitle'
|
|
||||||
defaultMessage='Enable Post Formatting'
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
inputs={
|
|
||||||
<div>
|
|
||||||
<div className='radio'>
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
type='radio'
|
|
||||||
name='formatting'
|
|
||||||
checked={this.state.settings.formatting !== 'false'}
|
|
||||||
onChange={this.updateSetting.bind(this, 'formatting', 'true')}
|
|
||||||
/>
|
|
||||||
<FormattedMessage
|
|
||||||
id='user.settings.advance.on'
|
|
||||||
defaultMessage='On'
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
<br/>
|
|
||||||
</div>
|
|
||||||
<div className='radio'>
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
type='radio'
|
|
||||||
name='formatting'
|
|
||||||
checked={this.state.settings.formatting === 'false'}
|
|
||||||
onChange={this.updateSetting.bind(this, 'formatting', 'false')}
|
|
||||||
/>
|
|
||||||
<FormattedMessage
|
|
||||||
id='user.settings.advance.off'
|
|
||||||
defaultMessage='Off'
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
<br/>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<br/>
|
|
||||||
<FormattedMessage
|
|
||||||
id='user.settings.advance.formattingDesc'
|
|
||||||
defaultMessage='If enabled, posts will be formatted to create links, show emoji, style the text, and add line breaks. By default, this setting is enabled. Changing this setting requires the page to be refreshed.'
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
submit={() => this.handleSubmit('formatting')}
|
|
||||||
server_error={serverError}
|
|
||||||
updateSection={(e) => {
|
|
||||||
this.updateSection('');
|
|
||||||
e.preventDefault();
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
formattingSection = (
|
|
||||||
<SettingItemMin
|
|
||||||
title={
|
|
||||||
<FormattedMessage
|
|
||||||
id='user.settings.advance.formattingTitle'
|
|
||||||
defaultMessage='Enable Post Formatting'
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
describe={this.renderOnOffLabel(this.state.settings.formatting)}
|
|
||||||
updateSection={() => this.props.updateSection('formatting')}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let previewFeaturesSection;
|
let previewFeaturesSection;
|
||||||
@@ -432,7 +445,7 @@ export default class AdvancedSettingsDisplay extends React.Component {
|
|||||||
</h3>
|
</h3>
|
||||||
<div className='divider-dark first'/>
|
<div className='divider-dark first'/>
|
||||||
{ctrlSendSection}
|
{ctrlSendSection}
|
||||||
<div className='divider-light'/>
|
{formattingSectionDivider}
|
||||||
{formattingSection}
|
{formattingSection}
|
||||||
{previewFeaturesSectionDivider}
|
{previewFeaturesSectionDivider}
|
||||||
{previewFeaturesSection}
|
{previewFeaturesSection}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user