diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.js b/src/components/mrf_transparency_panel/mrf_transparency_panel.js index de3ffea5..a3353728 100644 --- a/src/components/mrf_transparency_panel/mrf_transparency_panel.js +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.js @@ -2,17 +2,18 @@ import { mapState } from 'vuex' import { get } from 'lodash' /** - * This function is for backwards compatibility - * We used to get a list of strings for instances that - * are rejected/quarantined/etc. Now we get an object - * `{ "instance": instance, "reason": reason }` + * This is for backwards compatibility. We originally didn't recieve + * extra info like a reason why an instance was rejected/quarantined/etc. + * Because we didn't want to break backwards compatibility it was decided + * to add an extra "info" key. */ -function toInstanceReasonObject (e) { - if (typeof e === 'object' && e !== null) { - return e - } else { - return { 'instance': e, 'reason': '' } - } +function toInstanceReasonObject (instances, info, key) { + return instances.map(instance => { + if (info[key] && info[key][instance] && info[key][instance]['reason']) { + return { 'instance': instance, 'reason': info[key][instance]['reason'] } + } + return { 'instance': instance, 'reason': '' } + }) } const MRFTransparencyPanel = { @@ -20,12 +21,36 @@ const MRFTransparencyPanel = { ...mapState({ federationPolicy: state => get(state, 'instance.federationPolicy'), mrfPolicies: state => get(state, 'instance.federationPolicy.mrf_policies', []), - quarantineInstances: state => get(state, 'instance.federationPolicy.quarantined_instances', []).map(toInstanceReasonObject), - 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', []), + quarantineInstances: state => toInstanceReasonObject( + get(state, 'instance.federationPolicy.quarantined_instances', []), + get(state, 'instance.federationPolicy.quarantined_instances_info', []), + 'quarantined_instances' + ), + acceptInstances: state => toInstanceReasonObject( + get(state, 'instance.federationPolicy.mrf_simple.accept', []), + get(state, 'instance.federationPolicy.mrf_simple_info', []), + 'accept' + ), + rejectInstances: state => toInstanceReasonObject( + get(state, 'instance.federationPolicy.mrf_simple.reject', []), + get(state, 'instance.federationPolicy.mrf_simple_info', []), + 'reject' + ), + ftlRemovalInstances: state => toInstanceReasonObject( + get(state, 'instance.federationPolicy.mrf_simple.federated_timeline_removal', []), + get(state, 'instance.federationPolicy.mrf_simple_info', []), + 'federated_timeline_removal' + ), + mediaNsfwInstances: state => toInstanceReasonObject( + get(state, 'instance.federationPolicy.mrf_simple.media_nsfw', []), + get(state, 'instance.federationPolicy.mrf_simple_info', []), + 'media_nsfw' + ), + mediaRemovalInstances: state => toInstanceReasonObject( + get(state, 'instance.federationPolicy.mrf_simple.media_removal', []), + get(state, 'instance.federationPolicy.mrf_simple_info', []), + 'media_removal' + ), keywordsFtlRemoval: state => get(state, 'instance.federationPolicy.mrf_keyword.federated_timeline_removal', []), keywordsReject: state => get(state, 'instance.federationPolicy.mrf_keyword.reject', []), keywordsReplace: state => get(state, 'instance.federationPolicy.mrf_keyword.replace', []) diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue index 79d18eda..c6548f51 100644 --- a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue @@ -31,13 +31,19 @@

{{ $t("about.mrf.simple.accept_desc") }}

- + + + + + + + + + +
{{ $t("about.mrf.simple.instance") }}{{ $t("about.mrf.simple.reason") }}
{{ entry.instance }}{{ entry.reason }}
@@ -45,13 +51,19 @@

{{ $t("about.mrf.simple.reject_desc") }}

- + + + + + + + + + +
{{ $t("about.mrf.simple.instance") }}{{ $t("about.mrf.simple.reason") }}
{{ entry.instance }}{{ entry.reason }}
@@ -79,13 +91,19 @@

{{ $t("about.mrf.simple.ftl_removal_desc") }}

- + + + + + + + + + +
{{ $t("about.mrf.simple.instance") }}{{ $t("about.mrf.simple.reason") }}
{{ entry.instance }}{{ entry.reason }}
@@ -93,13 +111,19 @@

{{ $t("about.mrf.simple.media_nsfw_desc") }}

- + + + + + + + + + +
{{ $t("about.mrf.simple.instance") }}{{ $t("about.mrf.simple.reason") }}
{{ entry.instance }}{{ entry.reason }}
@@ -107,13 +131,19 @@

{{ $t("about.mrf.simple.media_removal_desc") }}

- + + + + + + + + + +
{{ $t("about.mrf.simple.instance") }}{{ $t("about.mrf.simple.reason") }}
{{ entry.instance }}{{ entry.reason }}