Make compact layout only apply to Modern layout (#7382)

This commit is contained in:
Michael Telatynski 2021-12-15 16:27:02 +00:00 committed by GitHub
parent d9da2581b4
commit 71b561d471
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 11 deletions

View file

@ -417,6 +417,7 @@ export const SETTINGS: {[setting: string]: ISetting} = {
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
displayName: _td("Use a more compact 'Modern' layout"),
default: false,
controller: new IncompatibleController("layout", false, v => v !== Layout.Group),
},
"showRedactions": {
supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM,

View file

@ -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;
}
}