forked from AkkomaGang/admin-fe
Fix fetching MRF data in case it's undefined
This commit is contained in:
parent
767322c355
commit
dd88974338
2 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue