From 8e71ee5a5cb1a57d6bbc3a387996bc806e44282d Mon Sep 17 00:00:00 2001 From: Samuel Elliott Date: Wed, 14 Feb 2018 01:48:21 +0000 Subject: [PATCH] Undo stuff from samuelthomas2774/add-setting-events --- client/src/modules/plugin.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/client/src/modules/plugin.js b/client/src/modules/plugin.js index cc731c0b..b104c921 100644 --- a/client/src/modules/plugin.js +++ b/client/src/modules/plugin.js @@ -55,18 +55,13 @@ export default class Plugin { } async saveSettings(newSettings) { - const updatedSettings = []; - - for (let newCategory of newSettings) { - const category = this.config.find(c => c.category === newCategory.category); - for (let newSetting of newCategory.settings) { - const setting = category.settings.find(s => s.id === newSetting.id); - if (Utils.compare(setting.value, newSetting.value)) continue; - - let old_value = setting.value; - setting.value = newSetting.value; - updatedSettings.push({ category_id: category.category, setting_id: setting.id, value: setting.value, old_value }); - this.settingUpdated(category.category, setting.id, setting.value, old_value); + for (let category of newSettings) { + const oldCategory = this.pluginConfig.find(c => c.category === category.category); + for (let setting of category.settings) { + const oldSetting = oldCategory.settings.find(s => s.id === setting.id); + if (Utils.compare(oldSetting.value, setting.value)) continue; + oldSetting.value = setting.value; + if (this.settingChanged) this.settingChanged(category.category, setting.id, setting.value); } }