From 8d6750d9c2816e33a0444cd978f94009d8b85d47 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Fri, 5 Jul 2019 10:17:44 +0300
Subject: eslint --fix --ext .js,.vue src

---
 src/components/about/about.vue | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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

diff --git a/src/components/about/about.vue b/src/components/about/about.vue
index 13dec87c..62ae16ea 100644
--- a/src/components/about/about.vue
+++ b/src/components/about/about.vue
@@ -1,8 +1,8 @@
 <template>
   <div class="sidebar">
-    <instance-specific-panel></instance-specific-panel>
-    <features-panel v-if="showFeaturesPanel"></features-panel>
-    <terms-of-service-panel></terms-of-service-panel>
+    <instance-specific-panel />
+    <features-panel v-if="showFeaturesPanel" />
+    <terms-of-service-panel />
   </div>
 </template>
 
-- 
cgit v1.2.3-70-g09d2


From 5db77c839bcf2ec433c8618c5b2ef1ff850df613 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 8 Nov 2019 21:57:09 -0600
Subject: about page: fix hiding of instance-specific panel, flow ToS and ISP
 better

---
 src/components/about/about.js  | 7 ++++++-
 src/components/about/about.vue | 4 ++--
 2 files changed, 8 insertions(+), 3 deletions(-)

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

diff --git a/src/components/about/about.js b/src/components/about/about.js
index ae1cb182..92856b21 100644
--- a/src/components/about/about.js
+++ b/src/components/about/about.js
@@ -9,7 +9,12 @@ const About = {
     TermsOfServicePanel
   },
   computed: {
-    showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel }
+    showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel },
+    showInstanceSpecificPanel () {
+      return this.$store.state.instance.showInstanceSpecificPanel &&
+        !this.$store.getters.mergedConfig.hideISP &&
+        this.$store.state.instance.instanceSpecificPanelContent
+    }
   }
 }
 
diff --git a/src/components/about/about.vue b/src/components/about/about.vue
index 62ae16ea..10dad4bb 100644
--- a/src/components/about/about.vue
+++ b/src/components/about/about.vue
@@ -1,8 +1,8 @@
 <template>
   <div class="sidebar">
-    <instance-specific-panel />
-    <features-panel v-if="showFeaturesPanel" />
+    <instance-specific-panel v-if="showInstanceSpecificPanel" />
     <terms-of-service-panel />
+    <features-panel v-if="showFeaturesPanel" />
   </div>
 </template>
 
-- 
cgit v1.2.3-70-g09d2


From 20ccd93a176f911a43b3db3d595f3fdb3491934f Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 8 Nov 2019 23:21:07 -0600
Subject: about: add staff panel

---
 src/boot/after_store.js                    | 17 +++++++++++++++++
 src/components/about/about.js              |  4 +++-
 src/components/about/about.vue             |  1 +
 src/components/staff_panel/staff_panel.js  | 15 +++++++++++++++
 src/components/staff_panel/staff_panel.vue | 22 ++++++++++++++++++++++
 src/i18n/en.json                           |  3 +++
 6 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 src/components/staff_panel/staff_panel.js
 create mode 100644 src/components/staff_panel/staff_panel.vue

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

diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index 80a55849..e96baaf0 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -184,6 +184,20 @@ const getAppSecret = async ({ store }) => {
     })
 }
 
+const resolveStaffAccounts = async ({ store, accounts }) => {
+  let nicknames = accounts.map(uri => uri.split('/').pop())
+  const backendInteractor = store.state.api.backendInteractor
+
+  nicknames = nicknames.map(id => {
+    console.log('resolving staff account:', id)
+    return backendInteractor.fetchUser({ id })
+  })
+
+  nicknames = await Promise.all(nicknames)
+
+  store.dispatch('setInstanceOption', { name: 'staffAccounts', value: nicknames })
+}
+
 const getNodeInfo = async ({ store }) => {
   try {
     const res = await window.fetch('/nodeinfo/2.0.json')
@@ -212,6 +226,9 @@ const getNodeInfo = async ({ store }) => {
       const frontendVersion = window.___pleromafe_commit_hash
       store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion })
       store.dispatch('setInstanceOption', { name: 'tagPolicyAvailable', value: metadata.federation.mrf_policies.includes('TagPolicy') })
+
+      const accounts = metadata.staffAccounts
+      await resolveStaffAccounts({ store, accounts })
     } else {
       throw (res)
     }
diff --git a/src/components/about/about.js b/src/components/about/about.js
index 92856b21..5c95c079 100644
--- a/src/components/about/about.js
+++ b/src/components/about/about.js
@@ -1,12 +1,14 @@
 import InstanceSpecificPanel from '../instance_specific_panel/instance_specific_panel.vue'
 import FeaturesPanel from '../features_panel/features_panel.vue'
 import TermsOfServicePanel from '../terms_of_service_panel/terms_of_service_panel.vue'
+import StaffPanel from '../staff_panel/staff_panel.vue'
 
 const About = {
   components: {
     InstanceSpecificPanel,
     FeaturesPanel,
-    TermsOfServicePanel
+    TermsOfServicePanel,
+    StaffPanel
   },
   computed: {
     showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel },
diff --git a/src/components/about/about.vue b/src/components/about/about.vue
index 10dad4bb..ad520d11 100644
--- a/src/components/about/about.vue
+++ b/src/components/about/about.vue
@@ -1,6 +1,7 @@
 <template>
   <div class="sidebar">
     <instance-specific-panel v-if="showInstanceSpecificPanel" />
+    <staff-panel />
     <terms-of-service-panel />
     <features-panel v-if="showFeaturesPanel" />
   </div>
diff --git a/src/components/staff_panel/staff_panel.js b/src/components/staff_panel/staff_panel.js
new file mode 100644
index 00000000..b4d23079
--- /dev/null
+++ b/src/components/staff_panel/staff_panel.js
@@ -0,0 +1,15 @@
+import BasicUserCard from '../basic_user_card/basic_user_card.vue'
+
+const StaffPanel = {
+  components: {
+    BasicUserCard
+  },
+  computed: {
+    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
new file mode 100644
index 00000000..a74872d2
--- /dev/null
+++ b/src/components/staff_panel/staff_panel.vue
@@ -0,0 +1,22 @@
+<template>
+  <div class="staff-panel">
+    <div class="panel panel-default base01-background">
+      <div class="panel-heading timeline-heading base02-background">
+        <div class="title">
+          {{ $t("about.staff") }}
+        </div>
+      </div>
+      <div class="panel-body">
+        <basic-user-card
+          v-for="user in staffAccounts"
+          :user="user"
+          v-bind:key="user.screen_name" />
+      </div>
+    </div>
+  </div>
+</template>
+
+<script src="./staff_panel.js" ></script>
+
+<style lang="scss">
+</style>
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 483432ff..4cd66177 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -1,4 +1,7 @@
 {
+  "about": {
+    "staff": "Staff"
+  },
   "chat": {
     "title": "Chat"
   },
-- 
cgit v1.2.3-70-g09d2


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

---
 src/boot/after_store.js                            |  3 +
 src/components/about/about.js                      |  4 +-
 src/components/about/about.vue                     |  1 +
 .../mrf_transparency_panel.js                      | 33 ++++++++
 .../mrf_transparency_panel.vue                     | 91 ++++++++++++++++++++++
 src/i18n/en.json                                   | 18 ++++-
 6 files changed, 148 insertions(+), 2 deletions(-)
 create mode 100644 src/components/mrf_transparency_panel/mrf_transparency_panel.js
 create mode 100644 src/components/mrf_transparency_panel/mrf_transparency_panel.vue

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

diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index e96baaf0..bba3288c 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -227,6 +227,9 @@ const getNodeInfo = async ({ store }) => {
       store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion })
       store.dispatch('setInstanceOption', { name: 'tagPolicyAvailable', value: metadata.federation.mrf_policies.includes('TagPolicy') })
 
+      const federation = metadata.federation
+      store.dispatch('setInstanceOption', { name: 'federationPolicy', value: federation })
+
       const accounts = metadata.staffAccounts
       await resolveStaffAccounts({ store, accounts })
     } else {
diff --git a/src/components/about/about.js b/src/components/about/about.js
index 5c95c079..1df25845 100644
--- a/src/components/about/about.js
+++ b/src/components/about/about.js
@@ -2,13 +2,15 @@ import InstanceSpecificPanel from '../instance_specific_panel/instance_specific_
 import FeaturesPanel from '../features_panel/features_panel.vue'
 import TermsOfServicePanel from '../terms_of_service_panel/terms_of_service_panel.vue'
 import StaffPanel from '../staff_panel/staff_panel.vue'
+import MRFTransparencyPanel from '../mrf_transparency_panel/mrf_transparency_panel.vue'
 
 const About = {
   components: {
     InstanceSpecificPanel,
     FeaturesPanel,
     TermsOfServicePanel,
-    StaffPanel
+    StaffPanel,
+    MRFTransparencyPanel
   },
   computed: {
     showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel },
diff --git a/src/components/about/about.vue b/src/components/about/about.vue
index ad520d11..518f6184 100644
--- a/src/components/about/about.vue
+++ b/src/components/about/about.vue
@@ -3,6 +3,7 @@
     <instance-specific-panel v-if="showInstanceSpecificPanel" />
     <staff-panel />
     <terms-of-service-panel />
+    <MRFTransparencyPanel />
     <features-panel v-if="showFeaturesPanel" />
   </div>
 </template>
diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.js b/src/components/mrf_transparency_panel/mrf_transparency_panel.js
new file mode 100644
index 00000000..3791dd12
--- /dev/null
+++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.js
@@ -0,0 +1,33 @@
+const MRFTransparencyPanel = {
+  components: {
+  },
+  computed: {
+    federationPolicy() {
+      return this.$store.state.instance.federationPolicy
+    },
+    mrfPolicies() {
+      return this.$store.state.instance.federationPolicy.mrf_policies
+    },
+    acceptInstances() {
+      return this.$store.state.instance.federationPolicy.mrf_simple.accept
+    },
+    rejectInstances() {
+      return this.$store.state.instance.federationPolicy.mrf_simple.reject
+    },
+    quarantineInstances() {
+      return this.$store.state.instance.federationPolicy.quarantined_instances
+    },
+    ftlRemovalInstances() {
+      return this.$store.state.instance.federationPolicy.mrf_simple.federated_timeline_removal
+    },
+    mediaNsfwInstances() {
+      return this.$store.state.instance.federationPolicy.mrf_simple.media_nsfw
+    },
+    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
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>
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 4cd66177..ead333c1 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -1,6 +1,22 @@
 {
   "about": {
-    "staff": "Staff"
+    "staff": "Staff",
+    "federation": "Federation",
+    "mrf_policies": "Enabled MRF Policies",
+    "mrf_policies_desc": "MRF policies manipulate the federation behaviour of the instance.  The following policies are enabled:",
+    "mrf_policy_simple": "Instance-specific Policies",
+    "mrf_policy_simple_accept": "Accept",
+    "mrf_policy_simple_accept_desc": "This instance only accepts messages from the following instances:",
+    "mrf_policy_simple_reject": "Reject",
+    "mrf_policy_simple_reject_desc": "This instance will not accept messages from the following instances:",
+    "mrf_policy_simple_quarantine": "Quarantine",
+    "mrf_policy_simple_quarantine_desc": "This instance will send only public posts to the following instances:",
+    "mrf_policy_simple_ftl_removal": "Removal from \"The Whole Known Network\" Timeline",
+    "mrf_policy_simple_ftl_removal_desc": "This instance removes these instances from \"The Whole Known Network\" timeline:",
+    "mrf_policy_simple_media_removal": "Media Removal",
+    "mrf_policy_simple_media_removal_desc": "This instance removes media from posts on the following instances:",
+    "mrf_policy_simple_media_nsfw": "Media Force-set As Sensitive",
+    "mrf_policy_simple_media_nsfw_desc": "This instance forces media to be set sensitive in posts on the following instances:"
   },
   "chat": {
     "title": "Chat"
-- 
cgit v1.2.3-70-g09d2

