Fix calculatedAtLevel definition

This commit is contained in:
Travis Ralston 2020-07-30 08:41:51 -06:00
parent 7f404b0fe5
commit ad7c94917d
4 changed files with 20 additions and 5 deletions

View file

@ -402,7 +402,7 @@ export default class SettingsStore {
level: SettingLevel, level: SettingLevel,
roomId: string, roomId: string,
calculatedValue: any, calculatedValue: any,
calculatedAtLevel: any, calculatedAtLevel: SettingLevel,
): any { ): any {
let resultingValue = calculatedValue; let resultingValue = calculatedValue;

View file

@ -46,7 +46,12 @@ function getNotifier(): any { // TODO: [TS] Formal type that doesn't cause a cyc
} }
export class NotificationsEnabledController extends SettingController { export class NotificationsEnabledController extends SettingController {
public getValueOverride(level: SettingLevel, roomId: string, calculatedValue: any, calculatedAtLevel: any): any { public getValueOverride(
level: SettingLevel,
roomId: string,
calculatedValue: any,
calculatedAtLevel: SettingLevel,
): any {
if (!getNotifier().isPossible()) return false; if (!getNotifier().isPossible()) return false;
if (calculatedValue === null || calculatedAtLevel === "default") { if (calculatedValue === null || calculatedAtLevel === "default") {

View file

@ -33,11 +33,16 @@ export default abstract class SettingController {
* @param {String} roomId The room ID, may be null. * @param {String} roomId The room ID, may be null.
* @param {*} calculatedValue The value that the handlers think the setting should be, * @param {*} calculatedValue The value that the handlers think the setting should be,
* may be null. * may be null.
* @param {string} calculatedAtLevel The level for which the calculated value was * @param {SettingLevel} calculatedAtLevel The level for which the calculated value was
* calculated at. May be null. * calculated at. May be null.
* @return {*} The value that should be used, or null if no override is applicable. * @return {*} The value that should be used, or null if no override is applicable.
*/ */
public getValueOverride(level: SettingLevel, roomId: string, calculatedValue: any, calculatedAtLevel: any): any { public getValueOverride(
level: SettingLevel,
roomId: string,
calculatedValue: any,
calculatedAtLevel: SettingLevel,
): any {
return null; // no override return null; // no override
} }

View file

@ -22,7 +22,12 @@ import { SettingLevel } from "../SettingLevel";
export default class ThemeController extends SettingController { export default class ThemeController extends SettingController {
public static isLogin = false; public static isLogin = false;
public getValueOverride(level: SettingLevel, roomId: string, calculatedValue: any, calculatedAtLevel: any): any { public getValueOverride(
level: SettingLevel,
roomId: string,
calculatedValue: any,
calculatedAtLevel: SettingLevel,
): any {
if (!calculatedValue) return null; // Don't override null themes if (!calculatedValue) return null; // Don't override null themes
if (ThemeController.isLogin) return 'light'; if (ThemeController.isLogin) return 'light';