about: add staff panel

This commit is contained in:
Ariadne Conill 2019-11-08 23:21:07 -06:00
parent 5db77c839b
commit 20ccd93a17
6 changed files with 61 additions and 1 deletions

View file

@ -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 }) => { const getNodeInfo = async ({ store }) => {
try { try {
const res = await window.fetch('/nodeinfo/2.0.json') const res = await window.fetch('/nodeinfo/2.0.json')
@ -212,6 +226,9 @@ const getNodeInfo = async ({ store }) => {
const frontendVersion = window.___pleromafe_commit_hash const frontendVersion = window.___pleromafe_commit_hash
store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion }) store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion })
store.dispatch('setInstanceOption', { name: 'tagPolicyAvailable', value: metadata.federation.mrf_policies.includes('TagPolicy') }) store.dispatch('setInstanceOption', { name: 'tagPolicyAvailable', value: metadata.federation.mrf_policies.includes('TagPolicy') })
const accounts = metadata.staffAccounts
await resolveStaffAccounts({ store, accounts })
} else { } else {
throw (res) throw (res)
} }

View file

@ -1,12 +1,14 @@
import InstanceSpecificPanel from '../instance_specific_panel/instance_specific_panel.vue' import InstanceSpecificPanel from '../instance_specific_panel/instance_specific_panel.vue'
import FeaturesPanel from '../features_panel/features_panel.vue' import FeaturesPanel from '../features_panel/features_panel.vue'
import TermsOfServicePanel from '../terms_of_service_panel/terms_of_service_panel.vue' import TermsOfServicePanel from '../terms_of_service_panel/terms_of_service_panel.vue'
import StaffPanel from '../staff_panel/staff_panel.vue'
const About = { const About = {
components: { components: {
InstanceSpecificPanel, InstanceSpecificPanel,
FeaturesPanel, FeaturesPanel,
TermsOfServicePanel TermsOfServicePanel,
StaffPanel
}, },
computed: { computed: {
showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel }, showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel },

View file

@ -1,6 +1,7 @@
<template> <template>
<div class="sidebar"> <div class="sidebar">
<instance-specific-panel v-if="showInstanceSpecificPanel" /> <instance-specific-panel v-if="showInstanceSpecificPanel" />
<staff-panel />
<terms-of-service-panel /> <terms-of-service-panel />
<features-panel v-if="showFeaturesPanel" /> <features-panel v-if="showFeaturesPanel" />
</div> </div>

View file

@ -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

View file

@ -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>

View file

@ -1,4 +1,7 @@
{ {
"about": {
"staff": "Staff"
},
"chat": { "chat": {
"title": "Chat" "title": "Chat"
}, },