From 916f61014fc3a7b3231c1dc03c921d266e9175b9 Mon Sep 17 00:00:00 2001 From: Ilja Date: Sat, 24 Oct 2020 21:34:33 +0200 Subject: [PATCH] Add backwards compat as poc for quarantined instances --- .../mrf_transparency_panel.js | 16 +++++++++++++++- .../mrf_transparency_panel.vue | 13 ++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.js b/src/components/mrf_transparency_panel/mrf_transparency_panel.js index a0b600d2..eed3a760 100644 --- a/src/components/mrf_transparency_panel/mrf_transparency_panel.js +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.js @@ -1,12 +1,26 @@ 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 }` + */ +function to_instance_reason_object(e) { + if (typeof e === 'object' && e !== null) + return e + else + return {"instance": e, "reason": ""} + return e +} + const MRFTransparencyPanel = { computed: { ...mapState({ federationPolicy: state => get(state, 'instance.federationPolicy'), mrfPolicies: state => get(state, 'instance.federationPolicy.mrf_policies', []), - quarantineInstances: state => get(state, 'instance.federationPolicy.quarantined_instances', []), + quarantineInstances: state => get(state, 'instance.federationPolicy.quarantined_instances', []).map(to_instance_reason_object), 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', []), diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue index 94e57892..e68c1c56 100644 --- a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue @@ -64,15 +64,10 @@ Instance Reason - - - + + {{ entry.instance }} + {{ entry.reason }}