aboutsummaryrefslogtreecommitdiff
path: root/src/services/notification_utils
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2023-11-20 00:14:56 +0200
committerHenry Jameson <me@hjkos.com>2023-11-20 00:14:56 +0200
commit38b6f0a013ec09b4c54bfe830a92bde46290bda1 (patch)
tree373165b7d9073b77b576f3873657a3272526f4a1 /src/services/notification_utils
parentcdc0959135a1bb9c3fd0c4750a9cb6ede5d189cb (diff)
fix notification dot in favicon and mobile nav, minor refactor
Diffstat (limited to 'src/services/notification_utils')
-rw-r--r--src/services/notification_utils/notification_utils.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js
index cc7e6817..f19cd565 100644
--- a/src/services/notification_utils/notification_utils.js
+++ b/src/services/notification_utils/notification_utils.js
@@ -1,9 +1,10 @@
-import { filter, includes } from 'lodash'
import { muteWordHits } from '../status_parser/status_parser.js'
import { showDesktopNotification } from '../desktop_notification_utils/desktop_notification_utils.js'
import FaviconService from 'src/services/favicon_service/favicon_service.js'
+export const ACTIONABLE_NOTIFICATION_TYPES = new Set(['mention', 'pleroma:report', 'follow_request'])
+
let cachedBadgeUrl = null
export const notificationsFromStore = store => store.state.notifications.data
@@ -24,9 +25,9 @@ export const visibleTypes = store => {
].filter(_ => _))
}
-const statusNotifications = ['like', 'mention', 'repeat', 'pleroma:emoji_reaction', 'poll']
+const statusNotifications = new Set(['like', 'mention', 'repeat', 'pleroma:emoji_reaction', 'poll'])
-export const isStatusNotification = (type) => includes(statusNotifications, type)
+export const isStatusNotification = (type) => statusNotifications.has(type)
export const isValidNotification = (notification) => {
if (isStatusNotification(notification.type) && !notification.status) {
@@ -76,8 +77,15 @@ export const filteredNotificationsFromStore = (store, types) => {
)
}
-export const unseenNotificationsFromStore = store =>
- filter(filteredNotificationsFromStore(store), ({ seen }) => !seen)
+export const unseenNotificationsFromStore = store => {
+ const ignoreInactionableSeen = store.getters.mergedConfig.ignoreInactionableSeen
+
+ return filteredNotificationsFromStore(store).filter(({ seen, type }) => {
+ if (!ignoreInactionableSeen) return !seen
+ if (seen) return false
+ return ACTIONABLE_NOTIFICATION_TYPES.has(type)
+ })
+}
export const prepareNotificationObject = (notification, i18n) => {
if (cachedBadgeUrl === null) {