diff options
| author | Shpuld Shpludson <shp@cock.li> | 2021-02-12 08:05:55 +0000 |
|---|---|---|
| committer | Shpuld Shpludson <shp@cock.li> | 2021-02-12 08:05:55 +0000 |
| commit | 8b7c367b0478ac3907480e3a354612473fc0ba08 (patch) | |
| tree | fb4fb2d29c44c9efad0983055d18a503545428e7 /src/components/staff_panel/staff_panel.js | |
| parent | 647d75f27c89b0972a58c62e7ab741d339c545d0 (diff) | |
| parent | 481c71517e41cdfc097b489b781847e0319f71fa (diff) | |
Merge branch 'staff-grouping' into 'develop'
Group staff by role in the About page
Closes #737
See merge request pleroma/pleroma-fe!1309
Diffstat (limited to 'src/components/staff_panel/staff_panel.js')
| -rw-r--r-- | src/components/staff_panel/staff_panel.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/components/staff_panel/staff_panel.js b/src/components/staff_panel/staff_panel.js index 8665648a..b9561bf1 100644 --- a/src/components/staff_panel/staff_panel.js +++ b/src/components/staff_panel/staff_panel.js @@ -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 + }) } } |
