diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx index 70c0346c498..e7fa353e51a 100644 --- a/src/components/structures/LoggedInView.tsx +++ b/src/components/structures/LoggedInView.tsx @@ -147,6 +147,7 @@ class LoggedInView extends React.Component { protected readonly _roomView: React.RefObject; protected readonly _resizeContainer: React.RefObject; protected readonly resizeHandler: React.RefObject; + protected layoutWatcherRef: string; protected compactLayoutWatcherRef: string; protected backgroundImageWatcherRef: string; protected resizer: Resizer; @@ -190,6 +191,7 @@ class LoggedInView extends React.Component { ); this._matrixClient.on("RoomState.events", this.onRoomStateEvents); + this.layoutWatcherRef = SettingsStore.watchSetting("layout", null, this.onCompactLayoutChanged); this.compactLayoutWatcherRef = SettingsStore.watchSetting( "useCompactLayout", null, this.onCompactLayoutChanged, ); @@ -212,6 +214,7 @@ class LoggedInView extends React.Component { this._matrixClient.removeListener("sync", this.onSync); this._matrixClient.removeListener("RoomState.events", this.onRoomStateEvents); OwnProfileStore.instance.off(UPDATE_EVENT, this.refreshBackgroundImage); + SettingsStore.unwatchSetting(this.layoutWatcherRef); SettingsStore.unwatchSetting(this.compactLayoutWatcherRef); SettingsStore.unwatchSetting(this.backgroundImageWatcherRef); this.resizer.detach(); @@ -295,9 +298,9 @@ class LoggedInView extends React.Component { } }; - onCompactLayoutChanged = (setting, roomId, level, valueAtLevel, newValue) => { + private onCompactLayoutChanged = () => { this.setState({ - useCompactLayout: valueAtLevel, + useCompactLayout: SettingsStore.getValue("useCompactLayout"), }); }; diff --git a/src/components/views/elements/Field.tsx b/src/components/views/elements/Field.tsx index 85f397834f2..1dedf77a8b9 100644 --- a/src/components/views/elements/Field.tsx +++ b/src/components/views/elements/Field.tsx @@ -230,7 +230,7 @@ export default class Field extends React.PureComponent { /* eslint @typescript-eslint/no-unused-vars: ["error", { "ignoreRestSiblings": true }] */ const { element, prefixComponent, postfixComponent, className, onValidate, children, tooltipContent, forceValidity, tooltipClassName, list, validateOnBlur, validateOnChange, validateOnFocus, - usePlaceholderAsHint, + usePlaceholderAsHint, forceTooltipVisible, ...inputProps } = this.props; // Set some defaults for the element @@ -276,7 +276,7 @@ export default class Field extends React.PureComponent { if (tooltipContent || this.state.feedback) { fieldTooltip = ; diff --git a/src/components/views/settings/tabs/user/AppearanceUserSettingsTab.tsx b/src/components/views/settings/tabs/user/AppearanceUserSettingsTab.tsx index 8249f2f6152..aba8ef0340d 100644 --- a/src/components/views/settings/tabs/user/AppearanceUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/AppearanceUserSettingsTab.tsx @@ -118,12 +118,7 @@ export default class AppearanceUserSettingsTab extends React.Component - + { !SettingsStore.getValue("feature_new_layout_switcher") ? v !== Layout.Group), }, "showRedactions": { supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM, diff --git a/src/settings/controllers/IncompatibleController.ts b/src/settings/controllers/IncompatibleController.ts index aa064219f94..3621a736a43 100644 --- a/src/settings/controllers/IncompatibleController.ts +++ b/src/settings/controllers/IncompatibleController.ts @@ -27,7 +27,7 @@ export default class IncompatibleController extends SettingController { public constructor( private settingName: string, private forcedValue: any = false, - private incompatibleValue: any = true, + private incompatibleValue: any | ((v: any) => boolean) = true, ) { super(); } @@ -49,6 +49,9 @@ export default class IncompatibleController extends SettingController { } public get incompatibleSetting(): boolean { + if (typeof this.incompatibleValue === "function") { + return this.incompatibleValue(SettingsStore.getValue(this.settingName)); + } return SettingsStore.getValue(this.settingName) === this.incompatibleValue; } }