From cbceb7d1e802baa11d30c696f413e6406bdd205e Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Fri, 22 Dec 2023 13:00:02 +0000 Subject: [PATCH] add old settings migration --- public/scripts/extensions/quick-reply/index.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/public/scripts/extensions/quick-reply/index.js b/public/scripts/extensions/quick-reply/index.js index cbc74c5f2..e00eaf8ec 100644 --- a/public/scripts/extensions/quick-reply/index.js +++ b/public/scripts/extensions/quick-reply/index.js @@ -13,11 +13,6 @@ import { SettingsUi } from './src/ui/SettingsUi.js'; -//TODO move advanced QR options into own UI class - - - - const _VERBOSE = true; export const log = (...msg) => _VERBOSE ? console.log('[QR2]', ...msg) : null; export const warn = (...msg) => _VERBOSE ? console.warn('[QR2]', ...msg) : null; @@ -123,9 +118,17 @@ const loadSets = async () => { }; const loadSettings = async () => { - //TODO migrate old settings if (!extension_settings.quickReplyV2) { - extension_settings.quickReplyV2 = defaultSettings; + if (!extension_settings.quickReply) { + extension_settings.quickReplyV2 = defaultSettings; + } else { + extension_settings.quickReplyV2 = { + isEnabled: extension_settings.quickReply.quickReplyEnabled ?? false, + isCombined: false, + isPopout: false, + config: extension_settings.quickReply.selectedPreset ?? extension_settings.quickReply.name ?? 'Default', + }; + } } try { settings = QuickReplySettings.from(extension_settings.quickReplyV2);