biome format --write

This commit is contained in:
Henry Jameson 2026-01-06 16:22:52 +02:00
commit 9262e803ec
415 changed files with 54076 additions and 17419 deletions

View file

@ -18,11 +18,10 @@ const mastoApiNotificationTypes = new Set([
'move',
'poll',
'pleroma:emoji_reaction',
'pleroma:report'
'pleroma:report',
])
const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
const args = { credentials }
const { getters } = store
const rootState = store.rootState || store.state
@ -44,7 +43,10 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
return fetchNotifications({ store, args, older })
} else {
// fetch new notifications
if (since === undefined && timelineData.maxId !== Number.POSITIVE_INFINITY) {
if (
since === undefined &&
timelineData.maxId !== Number.POSITIVE_INFINITY
) {
args.since = timelineData.maxId
} else if (since !== null) {
args.since = since
@ -57,8 +59,10 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
// we can update the state in this session to mark them as read as well.
// The normal maxId-check does not tell if older notifications have changed
const notifications = timelineData.data
const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id)
const unreadNotifsIds = notifications.filter(n => !n.seen).map(n => n.id)
const readNotifsIds = notifications.filter((n) => n.seen).map((n) => n.id)
const unreadNotifsIds = notifications
.filter((n) => !n.seen)
.map((n) => n.id)
if (readNotifsIds.length > 0 && readNotifsIds.length > 0) {
const minId = Math.min(...unreadNotifsIds) // Oldest known unread notification
if (minId !== Infinity) {
@ -73,16 +77,19 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
}
const fetchNotifications = ({ store, args, older }) => {
return apiService.fetchTimeline(args)
return apiService
.fetchTimeline(args)
.then((response) => {
if (response.errors) {
if (response.status === 400 && response.statusText.includes('Invalid value for enum')) {
response
.statusText
if (
response.status === 400 &&
response.statusText.includes('Invalid value for enum')
) {
response.statusText
.matchAll(/(\w+) - Invalid value for enum./g)
.toArray()
.map(x => x[1])
.forEach(x => mastoApiNotificationTypes.delete(x))
.map((x) => x[1])
.forEach((x) => mastoApiNotificationTypes.delete(x))
return fetchNotifications({ store, args, older })
} else {
throw new Error(`${response.status} ${response.statusText}`)
@ -97,7 +104,7 @@ const fetchNotifications = ({ store, args, older }) => {
level: 'error',
messageKey: 'notifications.error',
messageArgs: [error.message],
timeout: 5000
timeout: 5000,
})
console.error(error)
})
@ -115,7 +122,7 @@ const startFetching = ({ credentials, store }) => {
const notificationsFetcher = {
fetchAndUpdate,
startFetching
startFetching,
}
export default notificationsFetcher