summaryrefslogtreecommitdiffstats
path: root/webapp/components
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-06-05 02:35:39 -0400
committerenahum <nahumhbl@gmail.com>2016-06-05 03:35:39 -0300
commit2965a00e9b9afd83227bd5bcb08d6e76d5f7c3aa (patch)
treeb3b10f13f746d78760030bc832d44dd4a6c48e8c /webapp/components
parent96373a0cc72f29a65f1c0d987ea05c634124f41f (diff)
downloadchat-2965a00e9b9afd83227bd5bcb08d6e76d5f7c3aa.tar.gz
chat-2965a00e9b9afd83227bd5bcb08d6e76d5f7c3aa.tar.bz2
chat-2965a00e9b9afd83227bd5bcb08d6e76d5f7c3aa.zip
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
Diffstat (limited to 'webapp/components')
-rw-r--r--webapp/components/user_settings/user_settings_advanced.jsx159
1 files changed, 86 insertions, 73 deletions
diff --git a/webapp/components/user_settings/user_settings_advanced.jsx b/webapp/components/user_settings/user_settings_advanced.jsx
index 558eb608e..f1a72aa0f 100644
--- a/webapp/components/user_settings/user_settings_advanced.jsx
+++ b/webapp/components/user_settings/user_settings_advanced.jsx
@@ -25,6 +25,8 @@ export default class AdvancedSettingsDisplay extends React.Component {
this.toggleFeature = this.toggleFeature.bind(this);
this.saveEnabledFeatures = this.saveEnabledFeatures.bind(this);
+ this.renderFormattingSection = this.renderFormattingSection.bind(this);
+
const preReleaseFeaturesKeys = Object.keys(PreReleaseFeatures);
const advancedSettings = PreferenceStore.getCategory(Constants.Preferences.CATEGORY_ADVANCED_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) {
switch (feature) {
case 'MARKDOWN_PREVIEW':
@@ -248,78 +329,10 @@ export default class AdvancedSettingsDisplay extends React.Component {
);
}
- let formattingSection;
- if (this.props.activeSection === 'formatting') {
- formattingSection = (
- <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={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')}
- />
- );
+ const formattingSection = this.renderFormattingSection();
+ let formattingSectionDivider = null;
+ if (formattingSection) {
+ formattingSectionDivider = <div className='divider-light'/>;
}
let previewFeaturesSection;
@@ -432,7 +445,7 @@ export default class AdvancedSettingsDisplay extends React.Component {
</h3>
<div className='divider-dark first'/>
{ctrlSendSection}
- <div className='divider-light'/>
+ {formattingSectionDivider}
{formattingSection}
{previewFeaturesSectionDivider}
{previewFeaturesSection}