Add mechanism for disabling Betas
This commit is contained in:
parent
158a0f90cb
commit
d2959e1acc
2 changed files with 10 additions and 2 deletions
|
@ -60,7 +60,10 @@ export const BetaPill = ({ onClick }: { onClick?: () => void }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const BetaCard = ({ title: titleOverride, featureId }: IProps) => {
|
const BetaCard = ({ title: titleOverride, featureId }: IProps) => {
|
||||||
const { title, caption, disclaimer, image } = SettingsStore.getBetaInfo(featureId);
|
const info = SettingsStore.getBetaInfo(featureId);
|
||||||
|
if (!info) return null; // Beta is invalid/disabled
|
||||||
|
|
||||||
|
const { title, caption, disclaimer, image } = info;
|
||||||
const value = SettingsStore.getValue(featureId);
|
const value = SettingsStore.getValue(featureId);
|
||||||
|
|
||||||
return <div className="mx_BetaCard">
|
return <div className="mx_BetaCard">
|
||||||
|
|
|
@ -258,7 +258,12 @@ export default class SettingsStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getBetaInfo(settingName: string) {
|
public static getBetaInfo(settingName: string) {
|
||||||
return SETTINGS[settingName]?.betaInfo;
|
// consider a beta disabled if the config is explicitly set to false, in which case treat as normal Labs flag
|
||||||
|
if (SettingsStore.isFeature(settingName)
|
||||||
|
&& SettingsStore.getValueAt(SettingLevel.CONFIG, settingName, null, true, true) !== false
|
||||||
|
) {
|
||||||
|
return SETTINGS[settingName]?.betaInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue