Add an override for the theme

So we can force the light theme on unthemeable pages like the login
& complete security page.

Fixes https://github.com/vector-im/riot-web/issues/12149
Fixes https://github.com/vector-im/riot-web/issues/12157
This commit is contained in:
David Baker 2020-01-31 12:28:14 +00:00
parent 630507304a
commit 2d9b111680
2 changed files with 19 additions and 0 deletions

View file

@ -19,9 +19,17 @@ import SettingController from "./SettingController";
import {DEFAULT_THEME, enumerateThemes} from "../../theme";
export default class ThemeController extends SettingController {
static isLogin = false;
static setIsLogin(val) {
ThemeController.isLogin = val;
}
getValueOverride(level, roomId, calculatedValue, calculatedAtLevel) {
if (!calculatedValue) return null; // Don't override null themes
if (ThemeController.isLogin) return 'light';
const themes = enumerateThemes();
// Override in case some no longer supported theme is stored here
if (!themes[calculatedValue]) {