From b0030f09f9f34a583f9770527c2233a49eef7bfc Mon Sep 17 00:00:00 2001 From: SnowCait Date: Mon, 30 Oct 2023 06:33:18 +0900 Subject: [PATCH] Fix unread --- web/src/routes/(app)/home/FollowingTimeline.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/src/routes/(app)/home/FollowingTimeline.svelte b/web/src/routes/(app)/home/FollowingTimeline.svelte index 713983eac..0461df4eb 100644 --- a/web/src/routes/(app)/home/FollowingTimeline.svelte +++ b/web/src/routes/(app)/home/FollowingTimeline.svelte @@ -148,6 +148,7 @@ const identifier = findIdentifier(event.tags); if (identifier === 'notifications/lastOpened') { console.log('[last read]', event); + $lastReadAt = event.created_at; $unreadEvents = []; } else if (identifier !== undefined) { console.log('[people list]', event); @@ -402,7 +403,7 @@ // Past notification const notificationTimeline = new NotificationTimeline($pubkey); const notifiedEventItems = await notificationTimeline.fetch(now, $lastReadAt); - $unreadEvents.push(...notifiedEventItems); + $unreadEvents.push(...notifiedEventItems.filter(x => x.event.created_at > $lastReadAt)); $unreadEvents = $unreadEvents; $notifiedEvents = notifiedEventItems; $loadingNotifications = false;