Handle groups that doesn't have key

This commit is contained in:
Angelina Filippova 2019-12-06 16:11:00 +09:00
parent c388d42d40
commit 2448ccee4a
2 changed files with 4 additions and 2 deletions

View file

@ -3,6 +3,8 @@ const nonAtomsObjects = ['match_actor', ':match_actor']
const objects = ['digest', 'pleroma_fe', 'masto_fe', 'poll_limits', 'styling']
const objectParents = ['mascots']
const groupWithoutKey = settings => settings.noKey ? settings.noKey[1] : false
// REFACTOR
export const parseTuples = (tuples, key) => {
return tuples.reduce((accum, item) => {
@ -69,7 +71,7 @@ export const valueHasTuples = (key, value) => {
export const wrapUpdatedSettings = (group, settings) => {
return Object.keys(settings).map((key) => {
const value = wrapValues(settings[key])
const value = groupWithoutKey(settings[key]) || wrapValues(settings[key])
return { group, key, value }
})
}

View file

@ -85,7 +85,7 @@ const settings = {
UpdateSettings({ commit }, { group, key, input, value, type }) {
key
? commit('UPDATE_SETTINGS', { group, key, input, value, type })
: commit('UPDATE_SETTINGS', { group, key: input, input: 'value', value, type })
: commit('UPDATE_SETTINGS', { group, key: input, input: 'noKey', value, type })
},
UpdateState({ commit }, { group, key, input, value }) {
key