refactored notifications into their own module separate from statuses (WIP)

This commit is contained in:
Henry Jameson 2023-11-16 19:26:18 +02:00
commit aad3225d25
10 changed files with 170 additions and 158 deletions

View file

@ -7,7 +7,7 @@ const state = { failCreateNotif: false }
export const showDesktopNotification = (rootState, desktopNotificationOpts) => {
if (!('Notification' in window && window.Notification.permission === 'granted')) return
if (rootState.statuses.notifications.desktopNotificationSilence) { return }
if (rootState.notifications.desktopNotificationSilence) { return }
if (isSWSupported()) {
swDesktopNotification(desktopNotificationOpts)

View file

@ -439,7 +439,6 @@ export const parseNotification = (data) => {
output.type = mastoDict[data.type] || data.type
output.seen = data.pleroma.is_seen
output.status = isStatusNotification(output.type) ? parseStatus(data.status) : null
output.action = output.status // TODO: Refactor, this is unneeded
output.target = output.type !== 'move'
? null
: parseUser(data.target)

View file

@ -6,7 +6,7 @@ import FaviconService from 'src/services/favicon_service/favicon_service.js'
let cachedBadgeUrl = null
export const notificationsFromStore = store => store.state.statuses.notifications.data
export const notificationsFromStore = store => store.state.notifications.data
export const visibleTypes = store => {
const rootState = store.rootState || store.state

View file

@ -21,7 +21,7 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
const args = { credentials }
const { getters } = store
const rootState = store.rootState || store.state
const timelineData = rootState.statuses.notifications
const timelineData = rootState.notifications
const hideMutedPosts = getters.mergedConfig.hideMutedPosts
args.includeTypes = mastoApiNotificationTypes