diff --git a/functions/index.js b/functions/index.js index 960cc9d65..baacd1749 100644 --- a/functions/index.js +++ b/functions/index.js @@ -1953,13 +1953,14 @@ exports.editPreset = functions.https.onCall((request, response) => { if (!isTagPresetNameValid(request.name)) { return { resultCode: -1 }; } else { + let set = { + name: request.name, + }; + if (request.config) set.config = request.config; return db .collection(`users/${request.uid}/presets`) .doc(request.presetid) - .set({ - config: request.config, - name: request.name, - }) + .set(set) .then((e) => { console.log(`user ${request.uid} updated a preset: ${request.name}`); return { diff --git a/src/js/popups/edit-preset-popup.js b/src/js/popups/edit-preset-popup.js index 682be2b9d..d80581b16 100644 --- a/src/js/popups/edit-preset-popup.js +++ b/src/js/popups/edit-preset-popup.js @@ -67,14 +67,20 @@ function apply() { let action = $("#presetWrapper #presetEdit").attr("action"); let inputVal = $("#presetWrapper #presetEdit input").val(); let presetid = $("#presetWrapper #presetEdit").attr("presetid"); - let configChanges = Config.getConfigChanges(); - let activeTagIds = []; - DB.getSnapshot().tags.forEach((tag) => { - if (tag.active) { - activeTagIds.push(tag.id); - } - }); - configChanges.tags = activeTagIds; + let updateConfig = $("#presetWrapper #presetEdit label input").prop( + "checked" + ); + let configChanges = null; + if (updateConfig) { + configChanges = Config.getConfigChanges(); + let activeTagIds = []; + DB.getSnapshot().tags.forEach((tag) => { + if (tag.active) { + activeTagIds.push(tag.id); + } + }); + configChanges.tags = activeTagIds; + } hide(); if (action === "add") { Loader.show(); @@ -119,7 +125,7 @@ function apply() { (preset) => preset.id == presetid )[0]; preset.name = inputVal; - preset.config = configChanges; + if (configChanges) preset.config = configChanges; Settings.update(); } else if (status === -1) { Notifications.add("Invalid preset name", 0);