From a501d698aabbf6a99909b80906a3aae5c5552c87 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 27 Oct 2020 19:20:25 -0600 Subject: [PATCH] Add a UI Feature flag for room history settings --- .../tabs/room/SecurityRoomSettingsTab.js | 16 ++++++++++++---- src/settings/Settings.ts | 4 ++++ src/settings/UIFeature.ts | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js index 0a0c693158..f72e78fa3f 100644 --- a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js @@ -25,6 +25,7 @@ import QuestionDialog from "../../../dialogs/QuestionDialog"; import StyledRadioGroup from '../../../elements/StyledRadioGroup'; import {SettingLevel} from "../../../../../settings/SettingLevel"; import SettingsStore from "../../../../../settings/SettingsStore"; +import {UIFeature} from "../../../../../settings/UIFeature"; export default class SecurityRoomSettingsTab extends React.Component { static propTypes = { @@ -350,6 +351,16 @@ export default class SecurityRoomSettingsTab extends React.Component { />; } + let historySection = (<> + {_t("Who can read history?")} +
+ {this._renderHistory()} +
+ ); + if (!SettingsStore.getValue(UIFeature.RoomHistorySettings)) { + historySection = null; + } + return (
{_t("Security & Privacy")}
@@ -371,10 +382,7 @@ export default class SecurityRoomSettingsTab extends React.Component { {this._renderRoomAccess()}
- {_t("Who can read history?")} -
- {this._renderHistory()} -
+ {historySection} ); } diff --git a/src/settings/Settings.ts b/src/settings/Settings.ts index c8430a1767..6f4357973a 100644 --- a/src/settings/Settings.ts +++ b/src/settings/Settings.ts @@ -630,6 +630,10 @@ export const SETTINGS: {[setting: string]: ISetting} = { supportedLevels: LEVELS_ACCOUNT_SETTINGS, default: null, }, + [UIFeature.RoomHistorySettings]: { + supportedLevels: LEVELS_UI_FEATURE, + default: true, + }, [UIFeature.AdvancedEncryption]: { supportedLevels: LEVELS_UI_FEATURE, default: true, diff --git a/src/settings/UIFeature.ts b/src/settings/UIFeature.ts index 231752e19c..82dfdf0bb5 100644 --- a/src/settings/UIFeature.ts +++ b/src/settings/UIFeature.ts @@ -31,4 +31,5 @@ export enum UIFeature { Flair = "UIFeature.flair", Communities = "UIFeature.communities", AdvancedSettings = "UIFeature.advancedSettings", + RoomHistorySettings = "UIFeature.roomHistorySettings", }