forked from AkkomaGang/admin-fe
Merge branch 'feature/update-mrf' into 'develop'
Show MRF settings that are enabled in MRF Policies setting Closes #129 and #126 See merge request pleroma/admin-fe!145
This commit is contained in:
commit
55eb374d36
4 changed files with 16 additions and 13 deletions
|
@ -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
|
- Remove ability to moderate users that don't have valid nickname
|
||||||
- Displays both labels and description in the header of group of settiings
|
- Displays both labels and description in the header of group of settiings
|
||||||
- Ability to add custom values in Pleroma.Upload.Filter.Mogrify setting
|
- 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
|
### Fixed
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ export default {
|
||||||
':parsers',
|
':parsers',
|
||||||
':providers',
|
':providers',
|
||||||
':method',
|
':method',
|
||||||
':rewrite_policy',
|
':policies',
|
||||||
'Pleroma.Web.Auth.Authenticator'
|
'Pleroma.Web.Auth.Authenticator'
|
||||||
].includes(this.setting.key) ||
|
].includes(this.setting.key) ||
|
||||||
(this.settingGroup.key === 'Pleroma.Emails.Mailer' && this.setting.key === ':adapter')
|
(this.settingGroup.key === 'Pleroma.Emails.Mailer' && this.setting.key === ':adapter')
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<div v-if="!loading" :class="isSidebarOpen" class="form-container">
|
<div v-if="!loading" :class="isSidebarOpen" class="form-container">
|
||||||
<div v-for="setting in mrfSettings" :key="setting.key">
|
<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)"/>
|
<setting :setting-group="setting" :data="getSettingData(setting)"/>
|
||||||
</el-form>
|
|
||||||
<el-divider v-if="setting" class="divider thick-line"/>
|
<el-divider v-if="setting" class="divider thick-line"/>
|
||||||
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<div class="submit-button-container">
|
<div class="submit-button-container">
|
||||||
<el-button class="submit-button" type="primary" @click="onSubmit">Submit</el-button>
|
<el-button class="submit-button" type="primary" @click="onSubmit">Submit</el-button>
|
||||||
|
@ -70,6 +70,16 @@ export default {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: i18n.t('settings.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() {
|
inputValue() {
|
||||||
if (this.setting.key === 'Pleroma.Web.Auth.Authenticator') {
|
if (this.setting.key === 'Pleroma.Web.Auth.Authenticator') {
|
||||||
return this.data.value
|
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'
|
return typeof this.data[this.setting.key] === 'string'
|
||||||
? [this.data[this.setting.key]]
|
? [this.data[this.setting.key]]
|
||||||
: this.data[this.setting.key]
|
: this.data[this.setting.key]
|
||||||
|
@ -71,7 +71,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
options(suggestions) {
|
options(suggestions) {
|
||||||
const prefixes = {
|
const prefixes = {
|
||||||
':rewrite_policy': 'Pleroma.Web.ActivityPub.MRF.',
|
':policies': 'Pleroma.Web.ActivityPub.MRF.',
|
||||||
'Pleroma.Web.Auth.Authenticator': 'Pleroma.Web.Auth.',
|
'Pleroma.Web.Auth.Authenticator': 'Pleroma.Web.Auth.',
|
||||||
':method': 'Pleroma.Captcha.',
|
':method': 'Pleroma.Captcha.',
|
||||||
':adapter': 'Swoosh.Adapters.',
|
':adapter': 'Swoosh.Adapters.',
|
||||||
|
@ -100,14 +100,6 @@ export default {
|
||||||
this.setting.key === ':args'
|
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) {
|
updateSetting(value, group, key, input, type) {
|
||||||
const updatedValue = getBooleanValue(value)
|
const updatedValue = getBooleanValue(value)
|
||||||
this.$store.dispatch('UpdateSettings', { group, key, input, value: updatedValue, type })
|
this.$store.dispatch('UpdateSettings', { group, key, input, value: updatedValue, type })
|
||||||
|
|
Loading…
Reference in a new issue