fix notifications not catching up with "read" status as intended

このコミットが含まれているのは:
Henry Jameson 2023-11-21 15:26:31 +02:00
コミット e36548579f
3個のファイルの変更10行の追加3行の削除

1
changelog.d/unreads-sync.fix ノーマルファイル
ファイルの表示

@ -0,0 +1 @@
unread notifications should now properly catch up (eventually) in polling mode

ファイルの表示

@ -671,6 +671,7 @@ const fetchTimeline = ({
timeline, timeline,
credentials, credentials,
since = false, since = false,
minId = false,
until = false, until = false,
userId = false, userId = false,
listId = false, listId = false,
@ -705,6 +706,9 @@ const fetchTimeline = ({
url = url(listId) url = url(listId)
} }
if (minId) {
params.push(['min_id', minId])
}
if (since) { if (since) {
params.push(['since_id', since]) params.push(['since_id', since])
} }

ファイルの表示

@ -49,9 +49,11 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
// The normal maxId-check does not tell if older notifications have changed // The normal maxId-check does not tell if older notifications have changed
const notifications = timelineData.data const notifications = timelineData.data
const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id) const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id)
const numUnseenNotifs = notifications.length - readNotifsIds.length const unreadNotifsIds = notifications.filter(n => !n.seen).map(n => n.id)
if (numUnseenNotifs > 0 && readNotifsIds.length > 0) { if (readNotifsIds.length > 0 && readNotifsIds.length > 0) {
args.since = Math.max(...readNotifsIds) const minId = Math.min(...unreadNotifsIds) // Oldest known unread notification
args.since = false // Don't use since_id since it sorta conflicts with min_id
args.minId = minId - 1 // go beyond
fetchNotifications({ store, args, older }) fetchNotifications({ store, args, older })
} }