client/settings: fix updating settings
Updating settings in browsing settings view has been reseting safety settings in post list.
This commit is contained in:
parent
3149c43b7e
commit
ad87506044
1 changed files with 2 additions and 2 deletions
|
@ -19,6 +19,7 @@ const defaultSettings = {
|
||||||
|
|
||||||
class Settings extends events.EventTarget {
|
class Settings extends events.EventTarget {
|
||||||
save(newSettings, silent) {
|
save(newSettings, silent) {
|
||||||
|
newSettings = Object.assign(this.get(), newSettings);
|
||||||
localStorage.setItem('settings', JSON.stringify(newSettings));
|
localStorage.setItem('settings', JSON.stringify(newSettings));
|
||||||
if (silent !== true) {
|
if (silent !== true) {
|
||||||
this.dispatchEvent(new CustomEvent('change', {
|
this.dispatchEvent(new CustomEvent('change', {
|
||||||
|
@ -30,8 +31,7 @@ class Settings extends events.EventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
get() {
|
get() {
|
||||||
let ret = {};
|
let ret = Object.assign({}, defaultSettings);
|
||||||
Object.assign(ret, defaultSettings);
|
|
||||||
try {
|
try {
|
||||||
Object.assign(ret, JSON.parse(localStorage.getItem('settings')));
|
Object.assign(ret, JSON.parse(localStorage.getItem('settings')));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue