Harden Settings using mapped types (#28775)
* Harden Settings using mapped types Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix issues found during hardening Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove oidc native flow stale key Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
4e1bd69e4d
commit
1e42f28a69
@@ -9,6 +9,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
import SettingController from "./SettingController";
|
||||
import { SettingLevel } from "../SettingLevel";
|
||||
import SettingsStore from "../SettingsStore";
|
||||
import { BooleanSettingKey } from "../Settings.tsx";
|
||||
|
||||
/**
|
||||
* Enforces that a boolean setting cannot be enabled if the incompatible setting
|
||||
@@ -17,7 +18,7 @@ import SettingsStore from "../SettingsStore";
|
||||
*/
|
||||
export default class IncompatibleController extends SettingController {
|
||||
public constructor(
|
||||
private settingName: string,
|
||||
private settingName: BooleanSettingKey,
|
||||
private forcedValue: any = false,
|
||||
private incompatibleValue: any | ((v: any) => boolean) = true,
|
||||
) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import { SettingLevel } from "../SettingLevel";
|
||||
import MatrixClientBackedController from "./MatrixClientBackedController";
|
||||
import { WatchManager } from "../WatchManager";
|
||||
import SettingsStore from "../SettingsStore";
|
||||
import { SettingKey } from "../Settings.tsx";
|
||||
|
||||
/**
|
||||
* Disables a given setting if the server unstable feature it requires is not supported
|
||||
@@ -28,7 +29,7 @@ export default class ServerSupportUnstableFeatureController extends MatrixClient
|
||||
* the features in the group are supported (all features in a group are required).
|
||||
*/
|
||||
public constructor(
|
||||
private readonly settingName: string,
|
||||
private readonly settingName: SettingKey,
|
||||
private readonly watchers: WatchManager,
|
||||
private readonly unstableFeatureGroups: string[][],
|
||||
private readonly stableVersion?: string,
|
||||
|
||||
@@ -9,6 +9,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
import SettingController from "./SettingController";
|
||||
import { SettingLevel } from "../SettingLevel";
|
||||
import SettingsStore from "../SettingsStore";
|
||||
import { SettingKey } from "../Settings.tsx";
|
||||
|
||||
/**
|
||||
* Enforces that a boolean setting cannot be enabled if the corresponding
|
||||
@@ -19,7 +20,7 @@ import SettingsStore from "../SettingsStore";
|
||||
*/
|
||||
export default class UIFeatureController extends SettingController {
|
||||
public constructor(
|
||||
private uiFeatureName: string,
|
||||
private uiFeatureName: SettingKey,
|
||||
private forcedValue = false,
|
||||
) {
|
||||
super();
|
||||
|
||||
Reference in New Issue
Block a user