]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix anonymous user theme
authorChocobozzz <me@florianbigard.com>
Fri, 31 Jul 2020 14:55:32 +0000 (16:55 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 31 Jul 2020 14:55:32 +0000 (16:55 +0200)
client/src/app/core/theme/theme.service.ts
client/src/app/core/users/user.model.ts

index 9dbf22e200147195b35014b752ede3054fa5f2a7..7e05fdddd4149e861e29b973733798193098fcc3 100644 (file)
@@ -111,9 +111,9 @@ export class ThemeService {
 
       this.pluginService.reloadLoadedScopes()
 
-      this.localStorageService.setItem(User.KEYS.THEME, JSON.stringify(theme), false)
+      this.localStorageService.setItem(User.KEYS.LAST_ACTIVE_THEME, JSON.stringify(theme), false)
     } else {
-      this.localStorageService.removeItem(User.KEYS.THEME, false)
+      this.localStorageService.removeItem(User.KEYS.LAST_ACTIVE_THEME, false)
     }
 
     this.oldThemeName = currentTheme
@@ -127,7 +127,7 @@ export class ThemeService {
     if (!this.auth.isLoggedIn()) {
       this.updateCurrentTheme()
 
-      this.localStorageService.watch([User.KEYS.THEME]).subscribe(
+      this.localStorageService.watch([ User.KEYS.THEME ]).subscribe(
         () => this.updateCurrentTheme()
       )
     }
@@ -138,7 +138,7 @@ export class ThemeService {
   }
 
   private loadAndSetFromLocalStorage () {
-    const lastActiveThemeString = this.localStorageService.getItem(User.KEYS.THEME)
+    const lastActiveThemeString = this.localStorageService.getItem(User.KEYS.LAST_ACTIVE_THEME)
     if (!lastActiveThemeString) return
 
     try {
index 6a56786d976b214eb3333fcb75adb9f07079170c..4256f370b9eff73c5edcfada15b05f4bfd4d1721 100644 (file)
@@ -23,7 +23,8 @@ export class User implements UserServerModel {
     AUTO_PLAY_VIDEO: 'auto_play_video',
     SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO: 'auto_play_next_video',
     AUTO_PLAY_VIDEO_PLAYLIST: 'auto_play_video_playlist',
-    THEME: 'last_active_theme',
+    THEME: 'theme',
+    LAST_ACTIVE_THEME: 'last_active_theme',
     VIDEO_LANGUAGES: 'video_languages'
   }