From ad875060446b07e26bc5d6c54979c6429a9b933a Mon Sep 17 00:00:00 2001 From: rr- Date: Sat, 10 Sep 2016 11:22:09 +0200 Subject: [PATCH] client/settings: fix updating settings Updating settings in browsing settings view has been reseting safety settings in post list. --- client/js/models/settings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/js/models/settings.js b/client/js/models/settings.js index d35a414..3a6d9e5 100644 --- a/client/js/models/settings.js +++ b/client/js/models/settings.js @@ -19,6 +19,7 @@ const defaultSettings = { class Settings extends events.EventTarget { save(newSettings, silent) { + newSettings = Object.assign(this.get(), newSettings); localStorage.setItem('settings', JSON.stringify(newSettings)); if (silent !== true) { this.dispatchEvent(new CustomEvent('change', { @@ -30,8 +31,7 @@ class Settings extends events.EventTarget { } get() { - let ret = {}; - Object.assign(ret, defaultSettings); + let ret = Object.assign({}, defaultSettings); try { Object.assign(ret, JSON.parse(localStorage.getItem('settings'))); } catch (e) {