From 20ccd93a176f911a43b3db3d595f3fdb3491934f Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 8 Nov 2019 23:21:07 -0600 Subject: [PATCH] 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 @@