Library follows and user notifications

This commit is contained in:
Eliot Berriot 2018-09-13 15:18:23 +00:00
parent a879993280
commit ecd395d6b0
41 changed files with 1191 additions and 347 deletions

View file

@ -42,6 +42,15 @@
<img class="ui right floated circular tiny avatar image" v-if="$store.state.auth.profile.avatar.square_crop" :src="$store.getters['instance/absoluteUrl']($store.state.auth.profile.avatar.square_crop)" />
</router-link>
<router-link class="item" v-if="$store.state.auth.authenticated" :to="{path: '/settings'}"><i class="setting icon"></i><translate>Settings</translate></router-link>
<router-link class="item" v-if="$store.state.auth.authenticated" :to="{name: 'notifications'}">
<i class="feed icon"></i>
<translate>Notifications</translate>
<div
v-if="$store.state.ui.notifications.inbox > 0"
:class="['ui', 'teal', 'label']">
{{ $store.state.ui.notifications.inbox }}</div>
<img class="ui right floated circular tiny avatar image" v-if="$store.state.auth.profile.avatar.square_crop" :src="$store.getters['instance/absoluteUrl']($store.state.auth.profile.avatar.square_crop)" />
</router-link>
<router-link class="item" v-if="$store.state.auth.authenticated" :to="{name: 'logout'}"><i class="sign out icon"></i><translate>Logout</translate></router-link>
<template v-else>
<router-link class="item" :to="{name: 'login'}"><i class="sign in icon"></i><translate>Login</translate></router-link>
@ -73,33 +82,6 @@
<div class="item" v-if="showAdmin">
<div class="header"><translate>Administration</translate></div>
<div class="menu">
<router-link
class="item"
v-if="$store.state.auth.availablePermissions['library']"
:to="{name: 'manage.library.files'}">
<i class="book icon"></i><translate>Library</translate>
<div
:class="['ui', {'teal': $store.state.ui.notifications.importRequests > 0}, 'label']"
:title="labels.pendingRequests">
{{ $store.state.ui.notifications.importRequests }}</div>
</router-link>
<router-link
class="item"
v-else-if="$store.state.auth.availablePermissions['upload']"
to="/library/import/launch">
<i class="download icon"></i><translate>Import music</translate>
</router-link>
<router-link
class="item"
v-if="$store.state.auth.availablePermissions['federation']"
:to="{path: '/manage/federation/libraries'}">
<i class="sitemap icon"></i><translate>Federation</translate>
<div
:class="['ui', {'teal': $store.state.ui.notifications.federation > 0}, 'label']"
:title="labels.pendingFollows">
{{ $store.state.ui.notifications.federation }}</div>
</router-link>
<router-link
class="item"
v-if="$store.state.auth.availablePermissions['settings']"
@ -207,11 +189,6 @@ export default {
mounted () {
$(this.$el).find('.menu .item').tab()
},
created () {
this.fetchNotificationsCount()
this.fetchInterval = setInterval(
this.fetchNotificationsCount, 1000 * 60 * 15)
},
destroy () {
if (this.fetchInterval) {
clearInterval(this.fetchInterval)
@ -260,11 +237,6 @@ export default {
return e
}).length > 0
},
fetchNotificationsCount () {
this.$store.dispatch('ui/fetchFederationNotificationsCount')
this.$store.dispatch('ui/fetchImportRequestsCount')
},
reorder: function (event) {
this.$store.commit('queue/reorder', {
tracks: this.tracksChangeBuffer, oldIndex: event.oldIndex, newIndex: event.newIndex})
@ -301,7 +273,6 @@ export default {
'$store.state.auth.availablePermissions': {
handler () {
this.showAdmin = this.getShowAdmin()
this.fetchNotificationsCount()
},
deep: true
}