client/settings: fix updating settings

Updating settings in browsing settings view has been reseting safety
settings in post list.
This commit is contained in:
rr- 2016-09-10 11:22:09 +02:00
parent 3149c43b7e
commit ad87506044

View file

@ -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) {