fix "can't find property of undefined" errors in mrf transparency panel
This commit is contained in:
parent
d3adffbefe
commit
fa38a41e42
|
@ -1,16 +1,27 @@
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
|
import { get } from 'lodash'
|
||||||
|
|
||||||
const MRFTransparencyPanel = {
|
const MRFTransparencyPanel = {
|
||||||
computed: mapState({
|
computed: {
|
||||||
federationPolicy: state => state.instance.federationPolicy,
|
...mapState({
|
||||||
mrfPolicies: state => state.instance.federationPolicy.mrf_policies,
|
federationPolicy: state => get(state, 'instance.federationPolicy'),
|
||||||
acceptInstances: state => state.instance.federationPolicy.mrf_simple.accept,
|
mrfPolicies: state => get(state, 'instance.federationPolicy.mrf_policies', []),
|
||||||
rejectInstances: state => state.instance.federationPolicy.mrf_simple.reject,
|
quarantineInstances: state => get(state, 'instance.federationPolicy.quarantined_instances', []),
|
||||||
quarantineInstances: state => state.instance.federationPolicy.quarantined_instances,
|
acceptInstances: state => get(state, 'instance.federationPolicy.mrf_simple.accept', []),
|
||||||
ftlRemovalInstances: state => state.instance.federationPolicy.mrf_simple.federated_timeline_removal,
|
rejectInstances: state => get(state, 'instance.federationPolicy.mrf_simple.reject', []),
|
||||||
mediaNsfwInstances: state => state.instance.federationPolicy.mrf_simple.media_nsfw,
|
ftlRemovalInstances: state => get(state, 'instance.federationPolicy.mrf_simple.federated_timeline_removal', []),
|
||||||
mediaRemovalInstances: state => state.instance.federationPolicy.mrf_simple.media_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
|
export default MRFTransparencyPanel
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
/>
|
/>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>{{ $t("about.mrf_policy_simple") }}</h2>
|
<h2 v-if="hasInstanceSpecificPolicies">
|
||||||
|
{{ $t("about.mrf_policy_simple") }}
|
||||||
|
</h2>
|
||||||
|
|
||||||
<div v-if="acceptInstances.length">
|
<div v-if="acceptInstances.length">
|
||||||
<h4>{{ $t("about.mrf_policy_simple_accept") }}</h4>
|
<h4>{{ $t("about.mrf_policy_simple_accept") }}</h4>
|
||||||
|
|
Loading…
Reference in New Issue