diff options
| author | HJ <30-hj@users.noreply.git.pleroma.social> | 2021-02-02 20:27:23 +0000 |
|---|---|---|
| committer | HJ <30-hj@users.noreply.git.pleroma.social> | 2021-02-02 20:27:23 +0000 |
| commit | 7d4c7e3b3fce5d16849e677703e17ea67da927c8 (patch) | |
| tree | 44e745d1bfb3cd84f1ca7ca5105ac14b0b5d5a5a /src/modules/config.js | |
| parent | de66267a07eb018cc0309ff6f9dd896d53ba3ff4 (diff) | |
| parent | 66f3e72b545a7f92d2569baa0fd52275a29d629a (diff) | |
Merge branch 'settings-changed' into 'develop'
Boolean settings improvements
See merge request pleroma/pleroma-fe!1257
Diffstat (limited to 'src/modules/config.js')
| -rw-r--r-- | src/modules/config.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/modules/config.js b/src/modules/config.js index cd088737..f992519e 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -76,18 +76,22 @@ export const instanceDefaultProperties = Object.entries(defaultState) .map(([key, value]) => key) const config = { - state: defaultState, + state: { ...defaultState }, getters: { - mergedConfig (state, getters, rootState, rootGetters) { + defaultConfig (state, getters, rootState, rootGetters) { const { instance } = rootState return { - ...state, - ...instanceDefaultProperties - .map(key => [key, state[key] === undefined - ? instance[key] - : state[key] - ]) - .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {}) + ...defaultState, + ...Object.fromEntries( + instanceDefaultProperties.map(key => [key, instance[key]]) + ) + } + }, + mergedConfig (state, getters, rootState, rootGetters) { + const { defaultConfig } = rootGetters + return { + ...defaultConfig, + ...state } } }, |
