Group staff members by role in the About page
This commit is contained in:
parent
8d9bf3efc8
commit
481c71517e
4 changed files with 45 additions and 9 deletions
|
@ -1,4 +1,6 @@
|
|||
import map from 'lodash/map'
|
||||
import groupBy from 'lodash/groupBy'
|
||||
import { mapGetters, mapState } from 'vuex'
|
||||
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
||||
|
||||
const StaffPanel = {
|
||||
|
@ -10,9 +12,21 @@ const StaffPanel = {
|
|||
BasicUserCard
|
||||
},
|
||||
computed: {
|
||||
staffAccounts () {
|
||||
return map(this.$store.state.instance.staffAccounts, nickname => this.$store.getters.findUser(nickname)).filter(_ => _)
|
||||
}
|
||||
groupedStaffAccounts () {
|
||||
const staffAccounts = map(this.staffAccounts, this.findUser).filter(_ => _)
|
||||
const groupedStaffAccounts = groupBy(staffAccounts, 'role')
|
||||
|
||||
return [
|
||||
{ role: 'admin', users: groupedStaffAccounts['admin'] },
|
||||
{ role: 'moderator', users: groupedStaffAccounts['moderator'] }
|
||||
].filter(group => group.users)
|
||||
},
|
||||
...mapGetters([
|
||||
'findUser'
|
||||
]),
|
||||
...mapState({
|
||||
staffAccounts: state => state.instance.staffAccounts
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue