lightened up notification utils by remove store stuff from it

This commit is contained in:
Henry Jameson 2026-06-02 23:53:11 +03:00
commit a31e6f660a
6 changed files with 13 additions and 14 deletions

View file

@ -66,6 +66,7 @@ const MobileNav = {
countExtraNotifications(
this.$store,
useMergedConfigStore().mergedConfig,
useAnnouncementsStore().unreadAnnouncementCount,
)
)
},

View file

@ -115,6 +115,7 @@ const Notifications = {
return countExtraNotifications(
this.$store,
useMergedConfigStore().mergedConfig,
useAnnouncementsStore().unreadAnnouncementCount,
)
},
unseenCountTitle() {

View file

@ -9,6 +9,7 @@ import {
maybeShowNotification,
} from '../services/notification_utils/notification_utils.js'
import { useI18nStore } from 'src/stores/i18n.js'
import { useMergedConfigStore } from 'src/stores/merged_config.js'
import { useReportsStore } from 'src/stores/reports.js'
import { useSyncConfigStore } from 'src/stores/sync_config.js'
@ -123,6 +124,7 @@ export const notifications = {
useMergedConfigStore().mergedConfig.notificationVisibility,
Object.values(useSyncConfigStore().prefsStorage.simple.muteFilters),
notification,
useI18nStore().i18n,
)
} else if (notification.seen) {
state.idStore[notification.id].seen = true

View file

@ -2,7 +2,6 @@ import { showDesktopNotification } from '../desktop_notification_utils/desktop_n
import { muteFilterHits } from '../status_parser/status_parser.js'
import { useAnnouncementsStore } from 'src/stores/announcements.js'
import { useI18nStore } from 'src/stores/i18n.js'
import FaviconService from 'src/services/favicon_service/favicon_service.js'
@ -76,6 +75,7 @@ export const maybeShowNotification = (
notificationVisibility,
muteFilters,
notification,
i18n,
) => {
const rootState = store.rootState || store.state
@ -89,7 +89,7 @@ export const maybeShowNotification = (
const notificationObject = prepareNotificationObject(
notification,
useI18nStore().i18n,
i18n,
)
showDesktopNotification(rootState, notificationObject)
}
@ -193,7 +193,7 @@ export const prepareNotificationObject = (notification, i18n) => {
return notifObj
}
export const countExtraNotifications = (store, mergedConfig) => {
export const countExtraNotifications = (store, mergedConfig, unreadAnnouncementCount) => {
const rootGetters = store.rootGetters || store.getters
if (!mergedConfig.showExtraNotifications) {
@ -205,7 +205,7 @@ export const countExtraNotifications = (store, mergedConfig) => {
? rootGetters.unreadChatCount
: 0,
mergedConfig.showAnnouncementsInExtraNotifications
? useAnnouncementsStore().unreadAnnouncementCount
? unreadAnnouncementCount
: 0,
mergedConfig.showFollowRequestsInExtraNotifications
? rootGetters.followRequestCount

View file

@ -1,8 +1,9 @@
/* eslint-env serviceworker */
import 'virtual:pleroma-fe/service_worker_env'
import { createI18n } from 'vue-i18n'
import { storage } from 'src/lib/storage.js'
import { INSTANCE_DEFAULT_CONFIG } from 'src/modules/default_config_state.js'
import { parseNotification } from 'src/services/entity_normalizer/entity_normalizer.service.js'
import { prepareNotificationObject } from 'src/services/notification_utils/notification_utils.js'
@ -33,7 +34,7 @@ function getWindowClients() {
}
const setSettings = async () => {
const piniaState = await storage.getItem('pinia-local-sync_config')
const piniaState = {}
const locale = piniaState.prefsStorage.simple.interfaceLanguage || 'en'
i18n.locale = locale
const notificationsNativeArray = Object.entries(