Commit a57925fc authored by Haelwenn's avatar Haelwenn
Browse files

Merge branch 'simplePolicy_reasons_for_instance_specific_policies' into 'develop'

Make MRF and Quarantine work with tuples

See merge request !187
parents bc5dcfba 3b7bcea8
Pipeline #36919 passed with stages
in 4 minutes and 42 seconds
......@@ -78,14 +78,25 @@ export const parseTuples = (tuples, key) => {
item.tuple[0] === ':replace' ||
item.tuple[0] === ':retries' ||
(item.tuple[0] === ':headers' && key === 'Pleroma.Web.MediaProxy.Invalidation.Http') ||
item.tuple[0] === ':crontab')) {
item.tuple[0] === ':crontab' ||
item.tuple[0] === ':transparency_exclusions' ||
item.tuple[0] === ':quarantined_instances' ||
key === ':mrf_simple')) {
if (item.tuple[0] === ':crontab') {
accum[item.tuple[0]] = item.tuple[1].reduce((acc, group) => {
return [...acc, { [group.tuple[1]]: { value: group.tuple[0], id: `f${(~~(Math.random() * 1e8)).toString(16)}` }}]
}, [])
} else {
accum[item.tuple[0]] = item.tuple[1].reduce((acc, group) => {
/**
* The ':quarantined_instances' and ':mrf_simple' settings have changed to a list of tuples instead of a list of strings.
* This is to have backwards compatibility for instances that still use strings.
*/
if (typeof group === 'string') {
return [...acc, group]
} else {
return [...acc, { [group.tuple[0]]: { value: group.tuple[1], id: `f${(~~(Math.random() * 1e8)).toString(16)}` }}]
}
}, [])
}
} else if (item.tuple[0] === ':icons') {
......
......@@ -87,7 +87,12 @@ export default {
return this.$store.state.app.device === 'desktop'
},
keyPlaceholder() {
return this.setting.key === ':replace' ? 'pattern' : 'key'
/**
* We can get 'key_placeholder' from the Pleroma BE. This wasn't always the case.
* We check for the key ':replace' for backwards compatibility for older Pleroma instances who didn't send 'key_placeholder' yet.
* The ':replace' key was the only key where this was needed.
*/
return this.setting.key_placeholder ? this.setting.key_placeholder : (this.setting.key === ':replace' ? 'pattern' : 'key')
},
settings() {
return this.$store.state.settings.settings
......@@ -96,7 +101,12 @@ export default {
return this.$store.state.settings.updatedSettings
},
valuePlaceholder() {
return this.setting.key === ':replace' ? 'replacement' : 'value'
/**
* We can get 'value_placeholder' from the Pleroma BE. This wasn't always the case.
* We check for the key ':replace' for backwards compatibility for older Pleroma instances who didn't send 'value_placeholder' yet.
* The ':replace' key was the only key where this was needed.
*/
return this.setting.value_placeholder ? this.setting.value_placeholder : (this.setting.key === ':replace' ? 'replacement' : 'value')
}
},
methods: {
......
Supports Markdown
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