Migrate legacy avatars enabled setting from localstorage

f8c631b4aa81dc1e16cbb4be6fac36251b0f3edb

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +8 -1Showing whitespace changes
public/scripts/power-user.js+8 -1
@@ -304,6 +304,7 @@ export let context_presets = [];
304const storage_keys = {304const storage_keys = {
305 auto_connect_legacy: 'AutoConnectEnabled',305 auto_connect_legacy: 'AutoConnectEnabled',
306 auto_load_chat_legacy: 'AutoLoadChatEnabled',306 auto_load_chat_legacy: 'AutoLoadChatEnabled',
307 hideChatAvatars_legacy: 'hideChatAvatarsEnabled',
307308
308 storyStringValidationCache: 'StoryStringValidationCache',309 storyStringValidationCache: 'StoryStringValidationCache',
309};310};
@@ -1422,9 +1423,10 @@ async function loadPowerUserSettings(settings, data) {
1422 context_presets = data.context;1423 context_presets = data.context;
1423 }1424 }
14241425
1425 // These are still local storage1426 // These are still local storage. Delete in 1.12.7
1426 const autoLoadChat = localStorage.getItem(storage_keys.auto_load_chat_legacy);1427 const autoLoadChat = localStorage.getItem(storage_keys.auto_load_chat_legacy);
1427 const autoConnect = localStorage.getItem(storage_keys.auto_connect_legacy);1428 const autoConnect = localStorage.getItem(storage_keys.auto_connect_legacy);
1429 const hideChatAvatars = localStorage.getItem(storage_keys.hideChatAvatars_legacy);
14281430
1429 if (autoLoadChat) {1431 if (autoLoadChat) {
1430 power_user.auto_load_chat = autoLoadChat === 'true';1432 power_user.auto_load_chat = autoLoadChat === 'true';
@@ -1436,6 +1438,11 @@ async function loadPowerUserSettings(settings, data) {
1436 localStorage.removeItem(storage_keys.auto_connect_legacy);1438 localStorage.removeItem(storage_keys.auto_connect_legacy);
1437 }1439 }
14381440
1441 if (hideChatAvatars) {
1442 power_user.hideChatAvatars_enabled = hideChatAvatars === 'true';
1443 localStorage.removeItem(storage_keys.hideChatAvatars_legacy);
1444 }
1445
1439 if (power_user.chat_display === '') {1446 if (power_user.chat_display === '') {
1440 power_user.chat_display = chat_styles.DEFAULT;1447 power_user.chat_display = chat_styles.DEFAULT;
1441 }1448 }