From b8e242cbee8a30318c5c3fddf5a29016dd72da9f Mon Sep 17 00:00:00 2001 From: Mo Date: Fri, 18 Feb 2022 07:53:39 -0600 Subject: [PATCH] fix: activate cached themes without entitlement check --- app/assets/javascripts/services/themeManager.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/services/themeManager.ts b/app/assets/javascripts/services/themeManager.ts index 2dbf103bc..14aa89bf5 100644 --- a/app/assets/javascripts/services/themeManager.ts +++ b/app/assets/javascripts/services/themeManager.ts @@ -160,7 +160,7 @@ export class ThemeManager extends ApplicationService { private async activateCachedThemes() { const cachedThemes = await this.getCachedThemes(); for (const theme of cachedThemes) { - this.activateTheme(theme); + this.activateTheme(theme, true); } } @@ -202,22 +202,26 @@ export class ThemeManager extends ApplicationService { } } - private activateTheme(theme: SNTheme) { + private activateTheme(theme: SNTheme, skipEntitlementCheck = false) { if (this.activeThemes.find((uuid) => uuid === theme.uuid)) { return; } + if ( + !skipEntitlementCheck && this.application.getFeatureStatus(theme.identifier) !== - FeatureStatus.Entitled + FeatureStatus.Entitled ) { return; } - this.activeThemes.push(theme.uuid); + const url = this.application.componentManager.urlForComponent(theme); if (!url) { return; } + this.activeThemes.push(theme.uuid); + const link = document.createElement('link'); link.href = url; link.type = 'text/css';