diff options
Diffstat (limited to 'src/modules/adminSettings.js')
| -rw-r--r-- | src/modules/adminSettings.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/modules/adminSettings.js b/src/modules/adminSettings.js index 44a4d409..a84fadbf 100644 --- a/src/modules/adminSettings.js +++ b/src/modules/adminSettings.js @@ -29,7 +29,7 @@ const adminSettingsStorage = { const config = state.config || {} const modifiedPaths = state.modifiedPaths || new Set() backendDbConfig.configs.forEach(c => { - const path = c.group + '.' + c.key + const path = [c.group, c.key] if (c.db) { c.db.forEach(x => modifiedPaths.add(path + '.' + x)) } @@ -44,16 +44,16 @@ const adminSettingsStorage = { } set(config, path, convert(c.value)) }) - console.log(config[':pleroma'][':welcome']) + console.log(config[':pleroma']) commit('updateAdminSettings', { config, modifiedPaths }) }, setInstanceAdminDescriptions ({ state, commit, dispatch }, { backendDescriptions }) { const convert = ({ children, description, label, key = '<ROOT>', group, suggestions }, path, acc) => { - const newPath = group ? group + '.' + key : key + const newPath = group ? [group, key] : [key] const obj = { description, label, suggestions } if (Array.isArray(children)) { children.forEach(c => { - convert(c, '.' + newPath, obj) + convert(c, newPath, obj) }) } set(acc, newPath, obj) @@ -61,12 +61,13 @@ const adminSettingsStorage = { const descriptions = {} backendDescriptions.forEach(d => convert(d, '', descriptions)) + console.log(descriptions[':pleroma']['Pleroma.Captcha']) commit('updateAdminDescriptions', { descriptions }) }, pushAdminSetting ({ rootState, state, commit, dispatch }, { path, value }) { - const [group, key, ...rest] = path.split(/\./g) + const [group, key, ...rest] = Array.isArray(path) ? path : path.split(/\./g) const clone = {} // not actually cloning the entire thing to avoid excessive writes - set(clone, rest.join('.'), value) + set(clone, rest, value) // TODO cleanup paths in modifiedPaths const convert = (value) => { |
