Merge pull request #5215 from matrix-org/t3chguy/fix/15179

UI Feature Flag: Disable advanced options and tidy up some copy
pull/21833/head
Michael Telatynski 2020-09-18 12:34:38 +01:00 committed by GitHub
commit 5a6ab95f84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 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

@ -36,6 +36,7 @@ import EventTilePreview from '../../../elements/EventTilePreview';
import StyledRadioGroup from "../../../elements/StyledRadioGroup"; import StyledRadioGroup from "../../../elements/StyledRadioGroup";
import classNames from 'classnames'; import classNames from 'classnames';
import { SettingLevel } from "../../../../../settings/SettingLevel"; import { SettingLevel } from "../../../../../settings/SettingLevel";
import {UIFeature} from "../../../../../settings/UIFeature";
interface IProps { interface IProps {
} }
@ -386,6 +387,8 @@ export default class AppearanceUserSettingsTab extends React.Component<IProps, I
}; };
private renderAdvancedSection() { private renderAdvancedSection() {
if (!SettingsStore.getValue(UIFeature.AdvancedSettings)) return null;
const brand = SdkConfig.get().brand; const brand = SdkConfig.get().brand;
const toggle = <div const toggle = <div
className="mx_AppearanceUserSettingsTab_AdvancedToggle" className="mx_AppearanceUserSettingsTab_AdvancedToggle"

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()) {
@ -352,6 +352,19 @@ export default class SecurityUserSettingsTab extends React.Component {
</React.Fragment>; </React.Fragment>;
} }
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}
@ -381,12 +394,7 @@ export default class SecurityUserSettingsTab extends React.Component {
{this._renderCurrentDeviceInfo()} {this._renderCurrentDeviceInfo()}
</div> </div>
{ privacySection } { privacySection }
<div className="mx_SettingsTab_heading">{_t("Advanced")}</div> { advancedSection }
<div className="mx_SettingsTab_section">
{this._renderIgnoredUsers()}
{this._renderManageInvites()}
<E2eAdvancedPanel />
</div>
</div> </div>
); );
} }

View File

@ -660,4 +660,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

@ -28,4 +28,5 @@ export enum UIFeature {
IdentityServer = "UIFeature.identityServer", IdentityServer = "UIFeature.identityServer",
ThirdPartyID = "UIFeature.thirdPartyId", ThirdPartyID = "UIFeature.thirdPartyId",
Flair = "UIFeature.flair", Flair = "UIFeature.flair",
AdvancedSettings = "UIFeature.advancedSettings",
} }