UI Feature Flag: Communities
This commit is contained in:
parent
9cc789756b
commit
2bea8457e9
6 changed files with 31 additions and 9 deletions
|
@ -55,4 +55,11 @@ export default abstract class SettingController {
|
|||
public onChange(level: SettingLevel, roomId: string, newValue: any) {
|
||||
// do nothing by default
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the setting has been disabled due to this controller.
|
||||
*/
|
||||
public get settingDisabled() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import SettingsStore from "../SettingsStore";
|
|||
* Settings using this controller are assumed to return `false` when disabled.
|
||||
*/
|
||||
export default class UIFeatureController extends SettingController {
|
||||
public constructor(private uiFeatureName: string) {
|
||||
public constructor(private uiFeatureName: string, private forcedValue = false) {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,14 @@ export default class UIFeatureController extends SettingController {
|
|||
calculatedValue: any,
|
||||
calculatedAtLevel: SettingLevel,
|
||||
): any {
|
||||
if (!SettingsStore.getValue(this.uiFeatureName)) {
|
||||
if (this.settingDisabled) {
|
||||
// per the docs: we force a disabled state when the feature isn't active
|
||||
return false;
|
||||
return this.forcedValue;
|
||||
}
|
||||
return null; // no override
|
||||
}
|
||||
|
||||
public get settingDisabled(): boolean {
|
||||
return !SettingsStore.getValue(this.uiFeatureName);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue