diff options
| author | Shpuld Shpludson <shp@cock.li> | 2021-07-19 16:11:11 +0000 |
|---|---|---|
| committer | Shpuld Shpludson <shp@cock.li> | 2021-07-19 16:11:11 +0000 |
| commit | 373b14e1e4cdab415eb2cc21108cedbf3c21fe6f (patch) | |
| tree | e6dd1a5c7fb04c12e7fd29ca2c9b21e15eb18243 | |
| parent | 19475ba356c3fd6c54ca0306d3ae392358c212d1 (diff) | |
| parent | 32d1a0e1813e706a298871361123636187cde9bc (diff) | |
Merge branch 'fix-settings-anon' into 'develop'
Fix Boolean/Choice settings not working properly on initial launch
See merge request pleroma/pleroma-fe!1389
| -rw-r--r-- | src/components/settings_modal/helpers/boolean_setting.js | 12 | ||||
| -rw-r--r-- | src/components/settings_modal/helpers/choice_setting.js | 9 |
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 index 1dda49f2..5c52f697 100644 --- 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 index 042e8106..a15f6bac 100644 --- 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: { |
