From 90f764224d7518da08653db285c5343ca5d078ac Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Sat, 9 Nov 2019 00:09:32 -0600
Subject: about: add MRF transparency panel

---
 .../mrf_transparency_panel.vue                     | 91 ++++++++++++++++++++++
 1 file changed, 91 insertions(+)
 create mode 100644 src/components/mrf_transparency_panel/mrf_transparency_panel.vue

(limited to 'src/components/mrf_transparency_panel/mrf_transparency_panel.vue')

diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue
new file mode 100644
index 00000000..f3507591
--- /dev/null
+++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue
@@ -0,0 +1,91 @@
+<template>
+  <div class="mrf-transparency-panel" v-if="federationPolicy">
+    <div class="panel panel-default base01-background">
+      <div class="panel-heading timeline-heading base02-background">
+        <div class="title">
+          {{ $t("about.federation") }}
+        </div>
+      </div>
+      <div class="panel-body">
+        <div class="mrf-section">
+          <h2>{{ $t("about.mrf_policies") }}</h2>
+          <p>{{ $t("about.mrf_policies_desc") }}</p>
+
+          <ul>
+            <li v-for="policy in mrfPolicies" v-bind:key="policy" v-text="policy" />
+          </ul>
+
+          <h2>{{ $t("about.mrf_policy_simple") }}</h2>
+
+          <div v-if="acceptInstances.length">
+            <h4>{{ $t("about.mrf_policy_simple_accept") }}</h4>
+
+            <p>{{ $t("about.mrf_policy_simple_accept_desc") }}</p>
+
+            <ul>
+              <li v-for="instance in acceptInstances" v-bind:key="instance" v-text="instance" />
+            </ul>
+          </div>
+
+          <div v-if="rejectInstances.length">
+            <h4>{{ $t("about.mrf_policy_simple_reject") }}</h4>
+
+            <p>{{ $t("about.mrf_policy_simple_reject_desc") }}</p>
+
+            <ul>
+              <li v-for="instance in rejectInstances" v-bind:key="instance" v-text="instance" />
+            </ul>
+          </div>
+
+          <div v-if="quarantineInstances.length">
+            <h4>{{ $t("about.mrf_policy_simple_quarantine") }}</h4>
+
+            <p>{{ $t("about.mrf_policy_simple_quarantine_desc") }}</p>
+
+            <ul>
+              <li v-for="instance in quarantineInstances" v-bind:key="instance" v-text="instance" />
+            </ul>
+          </div>
+
+          <div v-if="ftlRemovalInstances.length">
+            <h4>{{ $t("about.mrf_policy_simple_ftl_removal") }}</h4>
+
+            <p>{{ $t("about.mrf_policy_simple_ftl_removal_desc") }}</p>
+
+            <ul>
+              <li v-for="instance in ftlRemovalInstances" v-bind:key="instance" v-text="instance" />
+            </ul>
+          </div>
+
+          <div v-if="mediaNsfwInstances.length">
+            <h4>{{ $t("about.mrf_policy_simple_media_nsfw") }}</h4>
+
+            <p>{{ $t("about.mrf_policy_simple_media_nsfw_desc") }}</p>
+
+            <ul>
+              <li v-for="instance in mediaNsfwInstances" v-bind:key="instance" v-text="instance" />
+            </ul>
+          </div>
+
+          <div v-if="mediaRemovalInstances.length">
+            <h4>{{ $t("about.mrf_policy_simple_media_removal") }}</h4>
+
+            <p>{{ $t("about.mrf_policy_simple_media_removal_desc") }}</p>
+
+            <ul>
+              <li v-for="instance in mediaRemovalInstances" v-bind:key="instance" v-text="instance" />
+            </ul>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script src="./mrf_transparency_panel.js"></script>
+
+<style lang="scss">
+.mrf-section {
+  margin: 1em;
+}
+</style>
-- 
cgit v1.2.3-70-g09d2


From 6dfe3cc911e748767368cc920cac2d91b4805992 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Sat, 9 Nov 2019 00:23:22 -0600
Subject: lint

---
 .../mrf_transparency_panel.js                      | 17 ++++----
 .../mrf_transparency_panel.vue                     | 47 ++++++++++++++++++----
 src/components/staff_panel/staff_panel.js          |  3 +-
 src/components/staff_panel/staff_panel.vue         |  3 +-
 4 files changed, 50 insertions(+), 20 deletions(-)

(limited to 'src/components/mrf_transparency_panel/mrf_transparency_panel.vue')

diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.js b/src/components/mrf_transparency_panel/mrf_transparency_panel.js
index 3791dd12..d4e583b0 100644
--- a/src/components/mrf_transparency_panel/mrf_transparency_panel.js
+++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.js
@@ -2,32 +2,31 @@ const MRFTransparencyPanel = {
   components: {
   },
   computed: {
-    federationPolicy() {
+    federationPolicy () {
       return this.$store.state.instance.federationPolicy
     },
-    mrfPolicies() {
+    mrfPolicies () {
       return this.$store.state.instance.federationPolicy.mrf_policies
     },
-    acceptInstances() {
+    acceptInstances () {
       return this.$store.state.instance.federationPolicy.mrf_simple.accept
     },
-    rejectInstances() {
+    rejectInstances () {
       return this.$store.state.instance.federationPolicy.mrf_simple.reject
     },
-    quarantineInstances() {
+    quarantineInstances () {
       return this.$store.state.instance.federationPolicy.quarantined_instances
     },
-    ftlRemovalInstances() {
+    ftlRemovalInstances () {
       return this.$store.state.instance.federationPolicy.mrf_simple.federated_timeline_removal
     },
-    mediaNsfwInstances() {
+    mediaNsfwInstances () {
       return this.$store.state.instance.federationPolicy.mrf_simple.media_nsfw
     },
-    mediaRemovalInstances() {
+    mediaRemovalInstances () {
       return this.$store.state.instance.federationPolicy.mrf_simple.media_removal
     }
   }
 }
 
 export default MRFTransparencyPanel
-
diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue
index f3507591..2640d68c 100644
--- a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue
+++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue
@@ -1,5 +1,8 @@
 <template>
-  <div class="mrf-transparency-panel" v-if="federationPolicy">
+  <div
+    v-if="federationPolicy"
+    class="mrf-transparency-panel"
+  >
     <div class="panel panel-default base01-background">
       <div class="panel-heading timeline-heading base02-background">
         <div class="title">
@@ -12,7 +15,11 @@
           <p>{{ $t("about.mrf_policies_desc") }}</p>
 
           <ul>
-            <li v-for="policy in mrfPolicies" v-bind:key="policy" v-text="policy" />
+            <li
+              v-for="policy in mrfPolicies"
+              :key="policy"
+              v-text="policy"
+            />
           </ul>
 
           <h2>{{ $t("about.mrf_policy_simple") }}</h2>
@@ -23,7 +30,11 @@
             <p>{{ $t("about.mrf_policy_simple_accept_desc") }}</p>
 
             <ul>
-              <li v-for="instance in acceptInstances" v-bind:key="instance" v-text="instance" />
+              <li
+                v-for="instance in acceptInstances"
+                :key="instance"
+                v-text="instance"
+              />
             </ul>
           </div>
 
@@ -33,7 +44,11 @@
             <p>{{ $t("about.mrf_policy_simple_reject_desc") }}</p>
 
             <ul>
-              <li v-for="instance in rejectInstances" v-bind:key="instance" v-text="instance" />
+              <li
+                v-for="instance in rejectInstances"
+                :key="instance"
+                v-text="instance"
+              />
             </ul>
           </div>
 
@@ -43,7 +58,11 @@
             <p>{{ $t("about.mrf_policy_simple_quarantine_desc") }}</p>
 
             <ul>
-              <li v-for="instance in quarantineInstances" v-bind:key="instance" v-text="instance" />
+              <li
+                v-for="instance in quarantineInstances"
+                :key="instance"
+                v-text="instance"
+              />
             </ul>
           </div>
 
@@ -53,7 +72,11 @@
             <p>{{ $t("about.mrf_policy_simple_ftl_removal_desc") }}</p>
 
             <ul>
-              <li v-for="instance in ftlRemovalInstances" v-bind:key="instance" v-text="instance" />
+              <li
+                v-for="instance in ftlRemovalInstances"
+                :key="instance"
+                v-text="instance"
+              />
             </ul>
           </div>
 
@@ -63,7 +86,11 @@
             <p>{{ $t("about.mrf_policy_simple_media_nsfw_desc") }}</p>
 
             <ul>
-              <li v-for="instance in mediaNsfwInstances" v-bind:key="instance" v-text="instance" />
+              <li
+                v-for="instance in mediaNsfwInstances"
+                :key="instance"
+                v-text="instance"
+              />
             </ul>
           </div>
 
@@ -73,7 +100,11 @@
             <p>{{ $t("about.mrf_policy_simple_media_removal_desc") }}</p>
 
             <ul>
-              <li v-for="instance in mediaRemovalInstances" v-bind:key="instance" v-text="instance" />
+              <li
+                v-for="instance in mediaRemovalInstances"
+                :key="instance"
+                v-text="instance"
+              />
             </ul>
           </div>
         </div>
diff --git a/src/components/staff_panel/staff_panel.js b/src/components/staff_panel/staff_panel.js
index b4d23079..93e950ad 100644
--- a/src/components/staff_panel/staff_panel.js
+++ b/src/components/staff_panel/staff_panel.js
@@ -5,11 +5,10 @@ const StaffPanel = {
     BasicUserCard
   },
   computed: {
-    staffAccounts() {
+    staffAccounts () {
       return this.$store.state.instance.staffAccounts
     }
   }
 }
 
 export default StaffPanel
-
diff --git a/src/components/staff_panel/staff_panel.vue b/src/components/staff_panel/staff_panel.vue
index a74872d2..1d13003d 100644
--- a/src/components/staff_panel/staff_panel.vue
+++ b/src/components/staff_panel/staff_panel.vue
@@ -9,8 +9,9 @@
       <div class="panel-body">
         <basic-user-card
           v-for="user in staffAccounts"
+          :key="user.screen_name"
           :user="user"
-          v-bind:key="user.screen_name" />
+        />
       </div>
     </div>
   </div>
-- 
cgit v1.2.3-70-g09d2


From fa38a41e42dbbbd5aa9d1aa2efb107d99ce8cd7d Mon Sep 17 00:00:00 2001
From: Shpuld Shpludson <shp@cock.li>
Date: Mon, 2 Dec 2019 12:20:24 +0000
Subject: fix "can't find property of undefined" errors in mrf transparency
 panel

---
 .../mrf_transparency_panel.js                      | 31 +++++++++++++++-------
 .../mrf_transparency_panel.vue                     |  4 ++-
 2 files changed, 24 insertions(+), 11 deletions(-)

(limited to 'src/components/mrf_transparency_panel/mrf_transparency_panel.vue')

diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.js b/src/components/mrf_transparency_panel/mrf_transparency_panel.js
index 20f8a08a..6a1baec8 100644
--- a/src/components/mrf_transparency_panel/mrf_transparency_panel.js
+++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.js
@@ -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
diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue
index 2640d68c..d6495dc6 100644
--- a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue
+++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue
@@ -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>
-- 
cgit v1.2.3-70-g09d2

