Commit 55eb374d authored by Angelina Filippova's avatar Angelina Filippova

Merge branch 'feature/update-mrf' into 'develop'

Show MRF settings that are enabled in MRF Policies setting

Closes #129 and #126

See merge request !145
parents d7eaf61a edd86b11
Pipeline #29031 passed with stages
in 9 minutes and 39 seconds
......@@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Remove ability to moderate users that don't have valid nickname
- Displays both labels and description in the header of group of settiings
- Ability to add custom values in Pleroma.Upload.Filter.Mogrify setting
- Show only those MRF settings that have been enabled in MRF Policies setting
### Fixed
......
......@@ -276,7 +276,7 @@ export default {
':parsers',
':providers',
':method',
':rewrite_policy',
':policies',
'Pleroma.Web.Auth.Authenticator'
].includes(this.setting.key) ||
(this.settingGroup.key === 'Pleroma.Emails.Mailer' && this.setting.key === ':adapter')
......
<template>
<div v-if="!loading" :class="isSidebarOpen" class="form-container">
<div v-for="setting in mrfSettings" :key="setting.key">
<el-form :model="getSettingData(setting)" :label-position="labelPosition" :label-width="labelWidth">
<el-form v-if="showMrfPolicy(setting.key)" :model="getSettingData(setting)" :label-position="labelPosition" :label-width="labelWidth">
<setting :setting-group="setting" :data="getSettingData(setting)"/>
<el-divider v-if="setting" class="divider thick-line"/>
</el-form>
<el-divider v-if="setting" class="divider thick-line"/>
</div>
<div class="submit-button-container">
<el-button class="submit-button" type="primary" @click="onSubmit">Submit</el-button>
......@@ -70,6 +70,16 @@ export default {
type: 'success',
message: i18n.t('settings.success')
})
},
showMrfPolicy(key) {
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
}
return acc
}, {})
return !Object.keys(mappedPolicies).includes(key) || selectedMrfPolicies.includes(mappedPolicies[key])
}
}
}
......
......@@ -56,7 +56,7 @@ export default {
inputValue() {
if (this.setting.key === 'Pleroma.Web.Auth.Authenticator') {
return this.data.value
} else if (this.setting.key === ':rewrite_policy') {
} else if (this.setting.key === ':policies') {
return typeof this.data[this.setting.key] === 'string'
? [this.data[this.setting.key]]
: this.data[this.setting.key]
......@@ -71,7 +71,7 @@ export default {
methods: {
options(suggestions) {
const prefixes = {
':rewrite_policy': 'Pleroma.Web.ActivityPub.MRF.',
':policies': 'Pleroma.Web.ActivityPub.MRF.',
'Pleroma.Web.Auth.Authenticator': 'Pleroma.Web.Auth.',
':method': 'Pleroma.Captcha.',
':adapter': 'Swoosh.Adapters.',
......@@ -100,14 +100,6 @@ export default {
this.setting.key === ':args'
)
},
rewritePolicyOptions(suggestions) {
return suggestions.map(element => {
const label = element.split('Pleroma.Web.ActivityPub.MRF.')[1]
? element.split('Pleroma.Web.ActivityPub.MRF.')[1]
: element
return { value: element, label }
})
},
updateSetting(value, group, key, input, type) {
const updatedValue = getBooleanValue(value)
this.$store.dispatch('UpdateSettings', { group, key, input, value: updatedValue, type })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment