UI Feature Flag: Disable advanced options and tidy up some copy

This commit is contained in:
Michael Telatynski 2020-09-16 12:14:33 +01:00
parent f4f94e31d1
commit 7a448be1dc
5 changed files with 40 additions and 24 deletions

View file

@ -29,6 +29,7 @@ import * as sdk from "../../../index";
import {MatrixClientPeg} from "../../../MatrixClientPeg"; import {MatrixClientPeg} from "../../../MatrixClientPeg";
import dis from "../../../dispatcher/dispatcher"; import dis from "../../../dispatcher/dispatcher";
import SettingsStore from "../../../settings/SettingsStore"; import SettingsStore from "../../../settings/SettingsStore";
import {UIFeature} from "../../../settings/UIFeature";
export const ROOM_GENERAL_TAB = "ROOM_GENERAL_TAB"; export const ROOM_GENERAL_TAB = "ROOM_GENERAL_TAB";
export const ROOM_SECURITY_TAB = "ROOM_SECURITY_TAB"; export const ROOM_SECURITY_TAB = "ROOM_SECURITY_TAB";
@ -96,12 +97,14 @@ export default class RoomSettingsDialog extends React.Component {
)); ));
} }
tabs.push(new Tab( if (SettingsStore.getValue(UIFeature.AdvancedSettings)) {
ROOM_ADVANCED_TAB, tabs.push(new Tab(
_td("Advanced"), ROOM_ADVANCED_TAB,
"mx_RoomSettingsDialog_warningIcon", _td("Advanced"),
<AdvancedRoomSettingsTab roomId={this.props.roomId} closeSettingsFn={this.props.onFinished} />, "mx_RoomSettingsDialog_warningIcon",
)); <AdvancedRoomSettingsTab roomId={this.props.roomId} closeSettingsFn={this.props.onFinished} />,
));
}
return tabs; return tabs;
} }

View file

@ -50,10 +50,10 @@ export default class PreferencesUserSettingsTab extends React.Component {
'showAvatarChanges', 'showAvatarChanges',
'showDisplaynameChanges', 'showDisplaynameChanges',
'showImages', 'showImages',
'Pill.shouldShowPillAvatar',
]; ];
static ADVANCED_SETTINGS = [ static GENERAL_SETTINGS = [
'Pill.shouldShowPillAvatar',
'TagPanel.enableTagPanel', 'TagPanel.enableTagPanel',
'promptBeforeInviteUnknownUsers', 'promptBeforeInviteUnknownUsers',
// Start automatically after startup (electron-only) // Start automatically after startup (electron-only)
@ -191,8 +191,8 @@ export default class PreferencesUserSettingsTab extends React.Component {
</div> </div>
<div className="mx_SettingsTab_section"> <div className="mx_SettingsTab_section">
<span className="mx_SettingsTab_subheading">{_t("Advanced")}</span> <span className="mx_SettingsTab_subheading">{_t("General")}</span>
{this._renderGroup(PreferencesUserSettingsTab.ADVANCED_SETTINGS)} {this._renderGroup(PreferencesUserSettingsTab.GENERAL_SETTINGS)}
{minimizeToTrayOption} {minimizeToTrayOption}
{autoHideMenuOption} {autoHideMenuOption}
{autoLaunchOption} {autoLaunchOption}

View file

@ -30,6 +30,8 @@ import dis from "../../../../../dispatcher/dispatcher";
import {privateShouldBeEncrypted} from "../../../../../createRoom"; import {privateShouldBeEncrypted} from "../../../../../createRoom";
import {SettingLevel} from "../../../../../settings/SettingLevel"; import {SettingLevel} from "../../../../../settings/SettingLevel";
import SecureBackupPanel from "../../SecureBackupPanel"; import SecureBackupPanel from "../../SecureBackupPanel";
import SettingsStore from "../../../../../settings/SettingsStore";
import {UIFeature} from "../../../../../settings/UIFeature";
export class IgnoredUser extends React.Component { export class IgnoredUser extends React.Component {
static propTypes = { static propTypes = {
@ -311,15 +313,13 @@ export default class SecurityUserSettingsTab extends React.Component {
// can remove this. // can remove this.
const CrossSigningPanel = sdk.getComponent('views.settings.CrossSigningPanel'); const CrossSigningPanel = sdk.getComponent('views.settings.CrossSigningPanel');
const crossSigning = ( const crossSigning = (
<div className='mx_SettingsTab_section'> <div className='mx_SettingsTab_section'>
<span className="mx_SettingsTab_subheading">{_t("Cross-signing")}</span> <span className="mx_SettingsTab_subheading">{_t("Cross-signing")}</span>
<div className='mx_SettingsTab_subsectionText'> <div className='mx_SettingsTab_subsectionText'>
<CrossSigningPanel /> <CrossSigningPanel />
</div>
</div> </div>
); </div>
);
const E2eAdvancedPanel = sdk.getComponent('views.settings.E2eAdvancedPanel');
let warning; let warning;
if (!privateShouldBeEncrypted()) { if (!privateShouldBeEncrypted()) {
@ -329,6 +329,19 @@ export default class SecurityUserSettingsTab extends React.Component {
</div>; </div>;
} }
const E2eAdvancedPanel = sdk.getComponent('views.settings.E2eAdvancedPanel');
let advancedSection;
if (SettingsStore.getValue(UIFeature.AdvancedSettings)) {
advancedSection = <>
<div className="mx_SettingsTab_heading">{_t("Advanced")}</div>
<div className="mx_SettingsTab_section">
{this._renderIgnoredUsers()}
{this._renderManageInvites()}
<E2eAdvancedPanel />
</div>
</>;
}
return ( return (
<div className="mx_SettingsTab mx_SecurityUserSettingsTab"> <div className="mx_SettingsTab mx_SecurityUserSettingsTab">
{warning} {warning}
@ -375,12 +388,7 @@ export default class SecurityUserSettingsTab extends React.Component {
<SettingsFlag name='analyticsOptIn' level={SettingLevel.DEVICE} <SettingsFlag name='analyticsOptIn' level={SettingLevel.DEVICE}
onChange={this._updateAnalytics} /> onChange={this._updateAnalytics} />
</div> </div>
<div className="mx_SettingsTab_heading">{_t("Advanced")}</div> { advancedSection }
<div className="mx_SettingsTab_section">
{this._renderIgnoredUsers()}
{this._renderManageInvites()}
<E2eAdvancedPanel />
</div>
</div> </div>
); );
} }

View file

@ -622,4 +622,8 @@ export const SETTINGS: {[setting: string]: ISetting} = {
supportedLevels: LEVELS_UI_FEATURE, supportedLevels: LEVELS_UI_FEATURE,
default: true, default: true,
}, },
[UIFeature.AdvancedSettings]: {
supportedLevels: LEVELS_UI_FEATURE,
default: true,
},
}; };

View file

@ -18,4 +18,5 @@ limitations under the License.
export enum UIFeature { export enum UIFeature {
URLPreviews = "UIFeature.urlPreviews", URLPreviews = "UIFeature.urlPreviews",
Widgets = "UIFeature.widgets", Widgets = "UIFeature.widgets",
AdvancedSettings = "UIFeature.advancedSettings",
} }