From 527b7bd7562bb9cd6806223d17e745ed6d6dcff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=A4ggmark?= Date: Tue, 20 Apr 2021 15:15:56 +0200 Subject: [PATCH] Theme: Theme toggle is only persisted for signed in users (#33163) --- public/app/core/services/toggleTheme.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/app/core/services/toggleTheme.ts b/public/app/core/services/toggleTheme.ts index 307dfea48db..0836b3cd1a8 100644 --- a/public/app/core/services/toggleTheme.ts +++ b/public/app/core/services/toggleTheme.ts @@ -3,6 +3,7 @@ import { ThemeChangedEvent } from 'app/types/events'; import appEvents from '../app_events'; import { config } from '../config'; import { PreferencesService } from './PreferencesService'; +import { contextSrv } from '../core'; export async function toggleTheme(runtimeOnly: boolean) { const currentTheme = config.theme; @@ -32,6 +33,10 @@ export async function toggleTheme(runtimeOnly: boolean) { } } + if (!contextSrv.isSignedIn) { + return; + } + // Persist new theme const service = new PreferencesService('user'); const currentPref = await service.load();