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

Fix fetching MRF data in case it's undefined

parent 767322c3
No related branches found
No related tags found
No related merge requests found
......@@ -223,9 +223,12 @@ const users = {
},
async FetchTagPolicySetting({ commit, getters }) {
const { data } = await fetchSettings(getters.authHost, getters.token)
const mrfPolicies = data.configs
.find(el => el.key === ':mrf').value
.find(el => el.tuple[0] === ':policies').tuple[1] || []
const mrfSettings = data.configs.find(el => el.key === ':mrf')
? data.configs.find(el => el.key === ':mrf').value
: []
const mrfPolicies = mrfSettings.find(el => el.tuple[0] === ':policies')
? mrfSettings.find(el => el.tuple[0] === ':policies').tuple[1]
: []
commit('SET_TAG_POLICY', Array.isArray(mrfPolicies) ? mrfPolicies : [mrfPolicies])
},
......
......@@ -69,7 +69,7 @@ export default {
})
},
showMrfPolicy(key) {
const selectedMrfPolicies = _.get(this.settings.settings, [':pleroma', ':mrf', ':policies'])
const selectedMrfPolicies = _.get(this.settings.settings, [':pleroma', ':mrf', ':policies']) || []
const mappedPolicies = this.mrfSettings.reduce((acc, { key, related_policy }) => {
if (key !== ':mrf') {
acc[key] = related_policy
......
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