From cf9c91dd027b335165f417b8676e7846249a1b6c Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 29 Jun 2025 01:09:59 +0300 Subject: [PATCH 1/5] microfix --- .../notifications_fetcher/notifications_fetcher.service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 06eddc2bd..b3b38e275 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -28,7 +28,7 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => { const timelineData = rootState.notifications const hideMutedPosts = getters.mergedConfig.hideMutedPosts - if (store.rootState.instance.pleromaChatMessagesAvailable) { + if (rootState.instance.pleromaChatMessagesAvailable) { mastoApiNotificationTypes.push('pleroma:chat_mention') } From c5c27a21679add015020753263b3f3a94c9c1996 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 29 Jun 2025 01:49:07 +0300 Subject: [PATCH 2/5] custom emoji reactions feature check for akkoma --- src/boot/after_store.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/boot/after_store.js b/src/boot/after_store.js index c5be7781f..65c4c9205 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -260,7 +260,12 @@ const getNodeInfo = async ({ store }) => { store.dispatch('setInstanceOption', { name: 'safeDM', value: features.includes('safe_dm_mentions') }) store.dispatch('setInstanceOption', { name: 'shoutAvailable', value: features.includes('chat') }) store.dispatch('setInstanceOption', { name: 'pleromaChatMessagesAvailable', value: features.includes('pleroma_chat_messages') }) - store.dispatch('setInstanceOption', { name: 'pleromaCustomEmojiReactionsAvailable', value: features.includes('pleroma_custom_emoji_reactions') }) + store.dispatch('setInstanceOption', { + name: 'pleromaCustomEmojiReactionsAvailable', + value: + features.includes('pleroma_custom_emoji_reactions') || + features.includes('custom_emoji_reactions') + }) store.dispatch('setInstanceOption', { name: 'pleromaBookmarkFoldersAvailable', value: features.includes('pleroma:bookmark_folders') }) store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: features.includes('gopher') }) store.dispatch('setInstanceOption', { name: 'pollsAvailable', value: features.includes('polls') }) From 4b5e6804a99ddaeba7e2085f739edf49957ec113 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 29 Jun 2025 02:49:35 +0300 Subject: [PATCH 3/5] handle akkoma not supporting status notification type --- src/modules/instance.js | 1 + .../notifications_fetcher.service.js | 47 ++++++++++++------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/modules/instance.js b/src/modules/instance.js index 39d1fc662..eff3d8870 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -157,6 +157,7 @@ const defaultState = { pleromaCustomEmojiReactionsAvailable: false, pleromaBookmarkFoldersAvailable: false, pleromaPublicFavouritesAvailable: true, + statusNotificationTypeAvailable: true, gopherAvailable: false, mediaProxyAvailable: false, suggestionsEnabled: false, diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index b3b38e275..2526141c9 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -5,22 +5,24 @@ import { promiseInterval } from '../promise_interval/promise_interval.js' const update = ({ store, notifications, older }) => { store.dispatch('addNewNotifications', { notifications, older }) } +// +// For using include_types when fetching notifications. +// Note: chat_mention excluded as pleroma-fe polls them separately +const mastoApiNotificationTypes = new Set([ + 'mention', + 'status', + 'favourite', + 'reblog', + 'follow', + 'follow_request', + 'move', + 'poll', + 'pleroma:emoji_reaction', + 'pleroma:report', + 'test' +]) const fetchAndUpdate = ({ store, credentials, older = false, since }) => { - // For using include_types when fetching notifications. - // Note: chat_mention excluded as pleroma-fe polls them separately - const mastoApiNotificationTypes = [ - 'mention', - 'status', - 'favourite', - 'reblog', - 'follow', - 'follow_request', - 'move', - 'poll', - 'pleroma:emoji_reaction', - 'pleroma:report' - ] const args = { credentials } const { getters } = store @@ -29,7 +31,11 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => { const hideMutedPosts = getters.mergedConfig.hideMutedPosts if (rootState.instance.pleromaChatMessagesAvailable) { - mastoApiNotificationTypes.push('pleroma:chat_mention') + mastoApiNotificationTypes.add('pleroma:chat_mention') + } + + if (!rootState.instance.statusNotificationTypeAvailable) { + mastoApiNotificationTypes.delete('status') } args.includeTypes = mastoApiNotificationTypes @@ -75,7 +81,16 @@ const fetchNotifications = ({ store, args, older }) => { return apiService.fetchTimeline(args) .then((response) => { if (response.errors) { - throw new Error(`${response.status} ${response.statusText}`) + if (response.status === 400) { + store.dispatch('setInstanceOption', { + name: 'statusNotificationTypeAvailable', + value: false + }) + mastoApiNotificationTypes.delete('status') + return fetchNotifications({ store, args, older }) + } else { + throw new Error(`${response.status} ${response.statusText}`) + } } const notifications = response.data update({ store, notifications, older }) From 114257359ca846c38af5bfa31e9b78f5f935d3ed Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 29 Jun 2025 03:18:09 +0300 Subject: [PATCH 4/5] fix infinite loop --- .../notifications_fetcher/notifications_fetcher.service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 2526141c9..676830733 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -81,7 +81,7 @@ const fetchNotifications = ({ store, args, older }) => { return apiService.fetchTimeline(args) .then((response) => { if (response.errors) { - if (response.status === 400) { + if (response.status === 400 && mastoApiNotificationTypes.has('status')) { store.dispatch('setInstanceOption', { name: 'statusNotificationTypeAvailable', value: false From e66b1edcf4d09b730b6cd705862db633b793825f Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 29 Jun 2025 15:24:04 +0300 Subject: [PATCH 5/5] better error handling --- src/services/api/api.service.js | 2 +- .../notifications_fetcher.service.js | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 6de94278e..5022e330d 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -759,7 +759,7 @@ const fetchTimeline = ({ if (replyVisibility !== 'all') { params.push(['reply_visibility', replyVisibility]) } - if (includeTypes.length > 0) { + if (includeTypes.size > 0) { includeTypes.forEach(type => { params.push(['include_types[]', type]) }) diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 676830733..89e000dd6 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -34,10 +34,6 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => { mastoApiNotificationTypes.add('pleroma:chat_mention') } - if (!rootState.instance.statusNotificationTypeAvailable) { - mastoApiNotificationTypes.delete('status') - } - args.includeTypes = mastoApiNotificationTypes args.withMuted = !hideMutedPosts @@ -81,12 +77,13 @@ const fetchNotifications = ({ store, args, older }) => { return apiService.fetchTimeline(args) .then((response) => { if (response.errors) { - if (response.status === 400 && mastoApiNotificationTypes.has('status')) { - store.dispatch('setInstanceOption', { - name: 'statusNotificationTypeAvailable', - value: false - }) - mastoApiNotificationTypes.delete('status') + 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)) return fetchNotifications({ store, args, older }) } else { throw new Error(`${response.status} ${response.statusText}`)