From 6cede475bec01755d168586b4a2a2241a8bc18ab Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 8 Nov 2019 21:53:53 -0600 Subject: [PATCH 1/9] nav panel: add link to about page --- src/components/nav_panel/nav_panel.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue index 614fadf4..28589bb1 100644 --- a/src/components/nav_panel/nav_panel.vue +++ b/src/components/nav_panel/nav_panel.vue @@ -38,6 +38,11 @@ {{ $t("nav.twkn") }} +
  • + + {{ $t("nav.about") }} + +
  • From 5db77c839bcf2ec433c8618c5b2ef1ff850df613 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 8 Nov 2019 21:57:09 -0600 Subject: [PATCH 2/9] 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(-) 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 @@ From 20ccd93a176f911a43b3db3d595f3fdb3491934f Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 8 Nov 2019 23:21:07 -0600 Subject: [PATCH 3/9] 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 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 @@ 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 @@ + + + + + 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" From 6dfe3cc911e748767368cc920cac2d91b4805992 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sat, 9 Nov 2019 00:23:22 -0600 Subject: [PATCH 5/9] 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(-) 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 @@