Show disabled spaces section in preferences regardless

This commit is contained in:
Michael Telatynski 2021-08-11 23:33:10 +01:00
parent 38dbe89316
commit 4f47907abf
4 changed files with 23 additions and 6 deletions

View file

@ -729,6 +729,7 @@ export const SETTINGS: {[setting: string]: ISetting} = {
description: _td("All rooms you're in will appear in Home."),
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
default: false,
controller: new IncompatibleController("showCommunitiesInsteadOfSpaces", null),
},
"showCommunitiesInsteadOfSpaces": {
displayName: _td("Display Communities instead of Spaces"),

View file

@ -467,6 +467,10 @@ export default class SettingsStore {
throw new Error("Setting '" + settingName + "' does not appear to be a setting.");
}
if (!SettingsStore.isEnabled(settingName)) {
return false;
}
// When non-beta features are specified in the config.json, we force them as enabled or disabled.
if (SettingsStore.isFeature(settingName) && !SETTINGS[settingName]?.betaInfo) {
const configVal = SettingsStore.getValueAt(SettingLevel.CONFIG, settingName, roomId, true, true);

View file

@ -26,7 +26,7 @@ import SettingsStore from "../SettingsStore";
export default class IncompatibleController extends SettingController {
public constructor(
private settingName: string,
private forcedValue = false,
private forcedValue: any = false,
private incompatibleValue: any = true,
) {
super();
@ -44,6 +44,10 @@ export default class IncompatibleController extends SettingController {
return null; // no override
}
public get settingDisabled(): boolean {
return this.incompatibleSetting;
}
public get incompatibleSetting(): boolean {
return SettingsStore.getValue(this.settingName) === this.incompatibleValue;
}