Skip to content
Snippets Groups Projects
Commit a518cc49 authored by Angelina Filippova's avatar Angelina Filippova
Browse files

Fix processing backends setting in logger group

parent 222697d0
No related branches found
No related tags found
1 merge request!65Update server configuration
......@@ -3,6 +3,14 @@ const nonAtomsObjects = ['match_actor', ':match_actor']
const objects = ['digest', 'pleroma_fe', 'masto_fe', 'poll_limits', 'styling']
const objectParents = ['mascots']
export const parseNonTuples = (key, value) => {
if (key === ':backends') {
const index = value.findIndex(el => Array.isArray(el) && el.includes(':ex_syslogger'))
const updated = value.map((el, i) => i === index ? ':ex_syslogger' : el)
return { value: updated }
}
return { value }
}
// REFACTOR
export const parseTuples = (tuples, key) => {
return tuples.reduce((accum, item) => {
......
import { fetchDescription, fetchSettings, updateSettings, uploadMedia } from '@/api/settings'
import { parseTuples, partialUpdate, valueHasTuples, wrapUpdatedSettings } from './normalizers'
import { parseNonTuples, parseTuples, partialUpdate, valueHasTuples, wrapUpdatedSettings } from './normalizers'
const settings = {
state: {
......@@ -38,7 +38,9 @@ const settings = {
},
SET_SETTINGS: (state, data) => {
const newSettings = data.reduce((acc, { group, key, value }) => {
const parsedValue = valueHasTuples(key, value) ? { value } : parseTuples(value, key)
const parsedValue = valueHasTuples(key, value)
? parseNonTuples(key, value)
: parseTuples(value, key)
acc[group][key] = { ...acc[group][key], ...parsedValue }
return acc
}, state.settings)
......
......@@ -36,7 +36,16 @@ export default {
},
methods: {
updateSetting(value, group, key, input, type) {
this.$store.dispatch('UpdateSettings', { group, key, input, value, type })
const updatedValue = () => {
const index = value.findIndex(el => el === ':ex_syslogger')
const updatedArray = value.slice()
if (index !== -1) {
updatedArray[index] = ['ExSyslogger', ':ex_syslogger']
}
return updatedArray
}
this.$store.dispatch('UpdateSettings', { group, key, input, value: updatedValue(), type })
this.$store.dispatch('UpdateState', { group, key, input, value })
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment