diff options
| author | Henry Jameson <me@hjkos.com> | 2023-11-19 15:24:34 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2023-11-19 15:24:34 +0200 |
| commit | e3ee3eaccae6a9ece674d7d76db8e67da499d6c3 (patch) | |
| tree | 611613d4f59f86442709ee5de13821aa06a5bf51 /src/components/notifications | |
| parent | 2f90c629b8e765cbc2ab024aa856d9a3e810d8f5 (diff) | |
added some settings for notifications
Diffstat (limited to 'src/components/notifications')
| -rw-r--r-- | src/components/notifications/notifications.js | 25 | ||||
| -rw-r--r-- | src/components/notifications/notifications.vue | 2 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js index a210e19d..00d3a511 100644 --- a/src/components/notifications/notifications.js +++ b/src/components/notifications/notifications.js @@ -21,6 +21,7 @@ library.add( ) const DEFAULT_SEEN_TO_DISPLAY_COUNT = 30 +const ACTIONABLE_NOTIFICATION_TYPES = new Set(['mention', 'pleroma:report', 'follow_request']) const Notifications = { components: { @@ -71,14 +72,26 @@ const Notifications = { return unseenNotificationsFromStore(this.$store) }, filteredNotifications () { - return filteredNotificationsFromStore(this.$store, this.filterMode) + if (this.unseenAtTop) { + return [ + ...filteredNotificationsFromStore(this.$store).filter(n => this.shouldShowUnseen(n)), + ...filteredNotificationsFromStore(this.$store).filter(n => !this.shouldShowUnseen(n)) + ] + } else { + return filteredNotificationsFromStore(this.$store, this.filterMode) + } }, unseenCountBadgeText () { return `${this.unseenCount ? this.unseenCount : ''}${this.extraNotificationsCount ? '*' : ''}` }, unseenCount () { - return this.unseenNotifications.length + if (this.ignoreInactionableSeen) { + return this.unseenNotifications.filter(n => ACTIONABLE_NOTIFICATION_TYPES.has(n.type)).length + } else { + return this.unseenNotifications.length + } }, + ignoreInactionableSeen () { return this.$store.getters.mergedConfig.ignoreInactionableSeen }, extraNotificationsCount () { return countExtraNotifications(this.$store) }, @@ -108,6 +121,7 @@ const Notifications = { return this.filteredNotifications.slice(0, this.unseenCount + this.seenToDisplayCount) }, noSticky () { return this.$store.getters.mergedConfig.disableStickyHeaders }, + unseenAtTop () { return this.$store.getters.mergedConfig.unseenAtTop }, showExtraNotifications () { return !this.noExtra }, @@ -154,11 +168,16 @@ const Notifications = { scrollToTop () { const scrollable = this.scrollerRef scrollable.scrollTo({ top: this.$refs.root.offsetTop }) - // this.$refs.root.scrollIntoView({ behavior: 'smooth', block: 'start' }) }, updateScrollPosition () { this.showScrollTop = this.$refs.root.offsetTop < this.scrollerRef.scrollTop }, + shouldShowUnseen (notification) { + if (notification.seen) return false + + const actionable = ACTIONABLE_NOTIFICATION_TYPES.has(notification.type) + return this.ignoreInactionableSeen ? actionable : true + }, /* "Interacted" really refers to "actionable" notifications that require user input, * everything else (likes/repeats/reacts) cannot be acted and therefore we just clear * the "seen" status upon any clicks on them diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue index 27ae23cf..a0025182 100644 --- a/src/components/notifications/notifications.vue +++ b/src/components/notifications/notifications.vue @@ -66,7 +66,7 @@ :key="notification.id" role="listitem" class="notification" - :class="{unseen: !minimalMode && !notification.seen}" + :class="{unseen: !minimalMode && shouldShowUnseen(notification)}" @click="e => notificationClicked(notification)" > <div class="notification-overlay" /> |
