Show disabled spaces section in preferences regardless
This commit is contained in:
parent
38dbe89316
commit
4f47907abf
4 changed files with 23 additions and 6 deletions
|
@ -285,8 +285,16 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
|
|||
SettingsStore.setValue("readMarkerOutOfViewThresholdMs", null, SettingLevel.DEVICE, e.target.value);
|
||||
};
|
||||
|
||||
private renderGroup(settingIds: string[], level = SettingLevel.ACCOUNT): React.ReactNodeArray {
|
||||
return settingIds.filter(SettingsStore.isEnabled).map(i => {
|
||||
private renderGroup(
|
||||
settingIds: string[],
|
||||
level = SettingLevel.ACCOUNT,
|
||||
includeDisabled = false,
|
||||
): React.ReactNodeArray {
|
||||
if (!includeDisabled) {
|
||||
settingIds = settingIds.filter(SettingsStore.isEnabled);
|
||||
}
|
||||
|
||||
return settingIds.map(i => {
|
||||
return <SettingsFlag key={i} name={i} level={level} />;
|
||||
});
|
||||
}
|
||||
|
@ -333,10 +341,10 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
|
|||
{ this.renderGroup(PreferencesUserSettingsTab.ROOM_LIST_SETTINGS) }
|
||||
</div>
|
||||
|
||||
{ SpaceStore.spacesEnabled && <div className="mx_SettingsTab_section">
|
||||
<div className="mx_SettingsTab_section">
|
||||
<span className="mx_SettingsTab_subheading">{ _t("Spaces") }</span>
|
||||
{ this.renderGroup(PreferencesUserSettingsTab.SPACES_SETTINGS) }
|
||||
</div> }
|
||||
{ this.renderGroup(PreferencesUserSettingsTab.SPACES_SETTINGS, SettingLevel.ACCOUNT, true) }
|
||||
</div>
|
||||
|
||||
<div className="mx_SettingsTab_section">
|
||||
<span className="mx_SettingsTab_subheading">{ _t("Communities") }</span>
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue