From ffb321bedca46d6987c7b31dd58e5dea96ea2ea2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 10 Jul 2019 14:06:19 +0200 Subject: WIP plugins: load theme on client side --- server/lib/plugins/theme-utils.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'server/lib/plugins') diff --git a/server/lib/plugins/theme-utils.ts b/server/lib/plugins/theme-utils.ts index 066339e65..76c671f1c 100644 --- a/server/lib/plugins/theme-utils.ts +++ b/server/lib/plugins/theme-utils.ts @@ -1,18 +1,18 @@ -import { DEFAULT_THEME } from '../../initializers/constants' +import { DEFAULT_THEME_NAME, DEFAULT_USER_THEME_NAME } from '../../initializers/constants' import { PluginManager } from './plugin-manager' import { CONFIG } from '../../initializers/config' -function getThemeOrDefault (name: string) { +function getThemeOrDefault (name: string, defaultTheme: string) { if (isThemeRegistered(name)) return name // Fallback to admin default theme - if (name !== CONFIG.THEME.DEFAULT) return getThemeOrDefault(CONFIG.THEME.DEFAULT) + if (name !== CONFIG.THEME.DEFAULT) return getThemeOrDefault(CONFIG.THEME.DEFAULT, DEFAULT_THEME_NAME) - return DEFAULT_THEME + return defaultTheme } function isThemeRegistered (name: string) { - if (name === DEFAULT_THEME) return true + if (name === DEFAULT_THEME_NAME || name === DEFAULT_USER_THEME_NAME) return true return !!PluginManager.Instance.getRegisteredThemes() .find(r => r.name === name) -- cgit v1.2.3