Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Hide pre-release features section of advanced settings pane. #333

Merged
merged 2 commits into from
Nov 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions components/user_settings/user_settings_advanced.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export default class AdvancedSettingsDisplay extends React.Component {
this.updateSection = this.updateSection.bind(this);
this.updateSetting = this.updateSetting.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);
this.renderJoinLeaveSection = this.renderJoinLeaveSection.bind(this);

Expand Down Expand Up @@ -77,11 +77,15 @@ export default class AdvancedSettingsDisplay extends React.Component {

const isSaving = false;

return {preReleaseFeatures: PreReleaseFeatures,
const previewFeaturesEnabled = global.window.mm_config.EnablePreviewFeatures === 'true';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default.json uses "EnablePreviewFeatures": true (with a Boolean value) but this is comparing against a string, and in JavaScript:

'true' === true // false

We should either compare against a Boolean only or both a Boolean and a string.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we do this everywhere because the server returns the client config as a JSON object with string values (an oversight from very early in the project)

We will eventually fix it but no one's gotten around to it yet

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh OK. I didn't realized. Thanks.


return {
preReleaseFeatures: PreReleaseFeatures,
settings,
preReleaseFeaturesKeys,
enabledFeatures,
isSaving
isSaving,
previewFeaturesEnabled
};
}

Expand Down Expand Up @@ -447,7 +451,7 @@ export default class AdvancedSettingsDisplay extends React.Component {

let previewFeaturesSection;
let previewFeaturesSectionDivider;
if (this.state.preReleaseFeaturesKeys.length > 0) {
if (this.state.previewFeaturesEnabled && this.state.preReleaseFeaturesKeys.length > 0) {
previewFeaturesSectionDivider = (
<div className='divider-light'/>
);
Expand Down