Display unread visuals when there are unread extra notifications
This commit is contained in:
parent
bd60238f01
commit
50bad0fc68
@ -39,6 +39,7 @@
|
|||||||
<Notifications
|
<Notifications
|
||||||
ref="notifications"
|
ref="notifications"
|
||||||
:no-heading="true"
|
:no-heading="true"
|
||||||
|
:no-extra="true"
|
||||||
:minimal-mode="true"
|
:minimal-mode="true"
|
||||||
:filter-mode="filterMode"
|
:filter-mode="filterMode"
|
||||||
/>
|
/>
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
import SideDrawer from '../side_drawer/side_drawer.vue'
|
import SideDrawer from '../side_drawer/side_drawer.vue'
|
||||||
import Notifications from '../notifications/notifications.vue'
|
import Notifications from '../notifications/notifications.vue'
|
||||||
import ConfirmModal from '../confirm_modal/confirm_modal.vue'
|
import ConfirmModal from '../confirm_modal/confirm_modal.vue'
|
||||||
import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils'
|
import {
|
||||||
|
unseenNotificationsFromStore,
|
||||||
|
countExtraNotifications
|
||||||
|
} from '../../services/notification_utils/notification_utils'
|
||||||
import GestureService from '../../services/gesture_service/gesture_service'
|
import GestureService from '../../services/gesture_service/gesture_service'
|
||||||
import NavigationPins from 'src/components/navigation/navigation_pins.vue'
|
import NavigationPins from 'src/components/navigation/navigation_pins.vue'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
@ -50,7 +53,7 @@ const MobileNav = {
|
|||||||
return unseenNotificationsFromStore(this.$store)
|
return unseenNotificationsFromStore(this.$store)
|
||||||
},
|
},
|
||||||
unseenNotificationsCount () {
|
unseenNotificationsCount () {
|
||||||
return this.unseenNotifications.length
|
return this.unseenNotifications.length + countExtraNotifications(this.$store)
|
||||||
},
|
},
|
||||||
hideSitename () { return this.$store.state.instance.hideSitename },
|
hideSitename () { return this.$store.state.instance.hideSitename },
|
||||||
sitename () { return this.$store.state.instance.name },
|
sitename () { return this.$store.state.instance.name },
|
||||||
|
@ -7,7 +7,8 @@ import notificationsFetcher from '../../services/notifications_fetcher/notificat
|
|||||||
import {
|
import {
|
||||||
notificationsFromStore,
|
notificationsFromStore,
|
||||||
filteredNotificationsFromStore,
|
filteredNotificationsFromStore,
|
||||||
unseenNotificationsFromStore
|
unseenNotificationsFromStore,
|
||||||
|
countExtraNotifications
|
||||||
} from '../../services/notification_utils/notification_utils.js'
|
} from '../../services/notification_utils/notification_utils.js'
|
||||||
import FaviconService from '../../services/favicon_service/favicon_service.js'
|
import FaviconService from '../../services/favicon_service/favicon_service.js'
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
@ -33,6 +34,11 @@ const Notifications = {
|
|||||||
minimalMode: Boolean,
|
minimalMode: Boolean,
|
||||||
// Custom filter mode, an array of strings, possible values 'mention', 'repeat', 'like', 'follow', used to override global filter for use in "Interactions" timeline
|
// Custom filter mode, an array of strings, possible values 'mention', 'repeat', 'like', 'follow', used to override global filter for use in "Interactions" timeline
|
||||||
filterMode: Array,
|
filterMode: Array,
|
||||||
|
// Do not show extra notifications
|
||||||
|
noExtra: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
// Disable teleporting (i.e. for /users/user/notifications)
|
// Disable teleporting (i.e. for /users/user/notifications)
|
||||||
disableTeleport: Boolean
|
disableTeleport: Boolean
|
||||||
},
|
},
|
||||||
@ -67,11 +73,17 @@ const Notifications = {
|
|||||||
filteredNotifications () {
|
filteredNotifications () {
|
||||||
return filteredNotificationsFromStore(this.$store, this.filterMode)
|
return filteredNotificationsFromStore(this.$store, this.filterMode)
|
||||||
},
|
},
|
||||||
|
unseenCountBadgeText () {
|
||||||
|
return `${this.unseenCount ? this.unseenCount : ''}${this.extraNotificationsCount ? '*' : ''}`
|
||||||
|
},
|
||||||
unseenCount () {
|
unseenCount () {
|
||||||
return this.unseenNotifications.length
|
return this.unseenNotifications.length
|
||||||
},
|
},
|
||||||
|
extraNotificationsCount () {
|
||||||
|
return countExtraNotifications(this.$store)
|
||||||
|
},
|
||||||
unseenCountTitle () {
|
unseenCountTitle () {
|
||||||
return this.unseenCount + (this.unreadChatCount) + this.unreadAnnouncementCount
|
return this.unseenNotifications.length + (this.unreadChatCount) + this.unreadAnnouncementCount
|
||||||
},
|
},
|
||||||
loading () {
|
loading () {
|
||||||
return this.$store.state.statuses.notifications.loading
|
return this.$store.state.statuses.notifications.loading
|
||||||
@ -97,7 +109,7 @@ const Notifications = {
|
|||||||
},
|
},
|
||||||
noSticky () { return this.$store.getters.mergedConfig.disableStickyHeaders },
|
noSticky () { return this.$store.getters.mergedConfig.disableStickyHeaders },
|
||||||
showExtraNotifications () {
|
showExtraNotifications () {
|
||||||
return !this.noHeading
|
return !this.noExtra
|
||||||
},
|
},
|
||||||
...mapGetters(['unreadChatCount', 'unreadAnnouncementCount'])
|
...mapGetters(['unreadChatCount', 'unreadAnnouncementCount'])
|
||||||
},
|
},
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
<div class="title">
|
<div class="title">
|
||||||
{{ $t('notifications.notifications') }}
|
{{ $t('notifications.notifications') }}
|
||||||
<span
|
<span
|
||||||
v-if="unseenCount"
|
v-if="unseenCountBadgeText"
|
||||||
class="badge badge-notification unseen-count"
|
class="badge badge-notification unseen-count"
|
||||||
>{{ unseenCount }}</span>
|
>{{ unseenCountBadgeText }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="showScrollTop"
|
v-if="showScrollTop"
|
||||||
|
@ -124,3 +124,17 @@ export const prepareNotificationObject = (notification, i18n) => {
|
|||||||
|
|
||||||
return notifObj
|
return notifObj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const countExtraNotifications = (store) => {
|
||||||
|
const mergedConfig = store.getters.mergedConfig
|
||||||
|
|
||||||
|
if (!mergedConfig.showExtraNotifications) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
mergedConfig.showChatsInExtraNotifications ? store.getters.unreadChatCount : 0,
|
||||||
|
mergedConfig.showAnnouncementsInExtraNotifications ? store.getters.unreadAnnouncementCount : 0,
|
||||||
|
mergedConfig.showFollowRequestsInExtraNotifications ? store.getters.followRequestCount : 0
|
||||||
|
].reduce((a, c) => a + c, 0)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user