forked from mirrors/akkoma-fe
about: add staff panel
This commit is contained in:
parent
5db77c839b
commit
20ccd93a17
6 changed files with 61 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -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>
|
||||
|
|
15
src/components/staff_panel/staff_panel.js
Normal file
15
src/components/staff_panel/staff_panel.js
Normal 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
|
||||
|
22
src/components/staff_panel/staff_panel.vue
Normal file
22
src/components/staff_panel/staff_panel.vue
Normal 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>
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"about": {
|
||||
"staff": "Staff"
|
||||
},
|
||||
"chat": {
|
||||
"title": "Chat"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue