From 80862e350a2aa8fd1fbb6e3880217a8848508593 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Sun, 19 Aug 2018 16:42:41 +0200 Subject: [PATCH] Fixed #245 (again): administration section not showing up in sidebar after login --- changes/changelog.d/245.bugfix | 1 + front/src/components/Sidebar.vue | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 changes/changelog.d/245.bugfix diff --git a/changes/changelog.d/245.bugfix b/changes/changelog.d/245.bugfix new file mode 100644 index 000000000..ae624f25d --- /dev/null +++ b/changes/changelog.d/245.bugfix @@ -0,0 +1 @@ +Fixed (again): administration section not showing up in sidebar after login (#245) diff --git a/front/src/components/Sidebar.vue b/front/src/components/Sidebar.vue index 4a3f42c77..803518528 100644 --- a/front/src/components/Sidebar.vue +++ b/front/src/components/Sidebar.vue @@ -191,7 +191,8 @@ export default { backend: backend, tracksChangeBuffer: null, isCollapsed: true, - fetchInterval: null + fetchInterval: null, + showAdmin: this.getShowAdmin() } }, mounted () { @@ -220,16 +221,6 @@ export default { pendingFollows } }, - showAdmin () { - let adminPermissions = [ - this.$store.state.auth.availablePermissions['federation'], - this.$store.state.auth.availablePermissions['library'], - this.$store.state.auth.availablePermissions['upload'] - ] - return adminPermissions.filter(e => { - return e - }).length > 0 - }, tracks: { get () { return this.$store.state.queue.tracks @@ -250,6 +241,17 @@ export default { ...mapActions({ cleanTrack: 'queue/cleanTrack' }), + getShowAdmin () { + let adminPermissions = [ + this.$store.state.auth.availablePermissions['federation'], + this.$store.state.auth.availablePermissions['library'], + this.$store.state.auth.availablePermissions['upload'] + ] + return adminPermissions.filter(e => { + return e + }).length > 0 + }, + fetchNotificationsCount () { this.$store.dispatch('ui/fetchFederationNotificationsCount') this.$store.dispatch('ui/fetchImportRequestsCount') @@ -289,6 +291,7 @@ export default { }, '$store.state.auth.availablePermissions': { handler () { + this.showAdmin = this.getShowAdmin() this.fetchNotificationsCount() }, deep: true