commit: 373b14e1e4cdab415eb2cc21108cedbf3c21fe6f
parent 19475ba356c3fd6c54ca0306d3ae392358c212d1
Author: Shpuld Shpludson <shp@cock.li>
Date: Mon, 19 Jul 2021 16:11:11 +0000
Merge branch 'fix-settings-anon' into 'develop'
Fix Boolean/Choice settings not working properly on initial launch
See merge request pleroma/pleroma-fe!1389
Diffstat:
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/components/settings_modal/helpers/boolean_setting.js b/src/components/settings_modal/helpers/boolean_setting.js
@@ -16,10 +16,18 @@ export default {
return [firstSegment + 'DefaultValue', ...rest].join('.')
},
state () {
- return get(this.$parent, this.path)
+ const value = get(this.$parent, this.path)
+ if (value === undefined) {
+ return this.defaultState
+ } else {
+ return value
+ }
+ },
+ defaultState () {
+ return get(this.$parent, this.pathDefault)
},
isChanged () {
- return get(this.$parent, this.path) !== get(this.$parent, this.pathDefault)
+ return this.state !== this.defaultState
}
},
methods: {
diff --git a/src/components/settings_modal/helpers/choice_setting.js b/src/components/settings_modal/helpers/choice_setting.js
@@ -17,13 +17,18 @@ export default {
return [firstSegment + 'DefaultValue', ...rest].join('.')
},
state () {
- return get(this.$parent, this.path)
+ const value = get(this.$parent, this.path)
+ if (value === undefined) {
+ return this.defaultState
+ } else {
+ return value
+ }
},
defaultState () {
return get(this.$parent, this.pathDefault)
},
isChanged () {
- return get(this.$parent, this.path) !== get(this.$parent, this.pathDefault)
+ return this.state !== this.defaultState
}
},
methods: {