Merge branch 'fix/mrf-js-errors' into 'develop'
fix "can't find property of undefined" errors in mrf transparency panel See merge request pleroma/pleroma-fe!1008
This commit is contained in:
commit
5096bff16c
2 changed files with 24 additions and 11 deletions
|
@ -1,16 +1,27 @@
|
|||
import { mapState } from 'vuex'
|
||||
import { get } from 'lodash'
|
||||
|
||||
const MRFTransparencyPanel = {
|
||||
computed: mapState({
|
||||
federationPolicy: state => state.instance.federationPolicy,
|
||||
mrfPolicies: state => state.instance.federationPolicy.mrf_policies,
|
||||
acceptInstances: state => state.instance.federationPolicy.mrf_simple.accept,
|
||||
rejectInstances: state => state.instance.federationPolicy.mrf_simple.reject,
|
||||
quarantineInstances: state => state.instance.federationPolicy.quarantined_instances,
|
||||
ftlRemovalInstances: state => state.instance.federationPolicy.mrf_simple.federated_timeline_removal,
|
||||
mediaNsfwInstances: state => state.instance.federationPolicy.mrf_simple.media_nsfw,
|
||||
mediaRemovalInstances: state => state.instance.federationPolicy.mrf_simple.media_removal
|
||||
})
|
||||
computed: {
|
||||
...mapState({
|
||||
federationPolicy: state => get(state, 'instance.federationPolicy'),
|
||||
mrfPolicies: state => get(state, 'instance.federationPolicy.mrf_policies', []),
|
||||
quarantineInstances: state => get(state, 'instance.federationPolicy.quarantined_instances', []),
|
||||
acceptInstances: state => get(state, 'instance.federationPolicy.mrf_simple.accept', []),
|
||||
rejectInstances: state => get(state, 'instance.federationPolicy.mrf_simple.reject', []),
|
||||
ftlRemovalInstances: state => get(state, 'instance.federationPolicy.mrf_simple.federated_timeline_removal', []),
|
||||
mediaNsfwInstances: state => get(state, 'instance.federationPolicy.mrf_simple.media_nsfw', []),
|
||||
mediaRemovalInstances: state => get(state, 'instance.federationPolicy.mrf_simple.media_removal', [])
|
||||
}),
|
||||
hasInstanceSpecificPolicies () {
|
||||
return this.quarantineInstances.length ||
|
||||
this.acceptInstances.length ||
|
||||
this.rejectInstances.length ||
|
||||
this.ftlRemovalInstances.length ||
|
||||
this.mediaNsfwInstances.length ||
|
||||
this.mediaRemovalInstances.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default MRFTransparencyPanel
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
/>
|
||||
</ul>
|
||||
|
||||
<h2>{{ $t("about.mrf_policy_simple") }}</h2>
|
||||
<h2 v-if="hasInstanceSpecificPolicies">
|
||||
{{ $t("about.mrf_policy_simple") }}
|
||||
</h2>
|
||||
|
||||
<div v-if="acceptInstances.length">
|
||||
<h4>{{ $t("about.mrf_policy_simple_accept") }}</h4>
|
||||
|
|
Loading…
Reference in a new issue