From ff938aa384b1b94533e5c5be1d67c5e074f278be Mon Sep 17 00:00:00 2001 From: Gigi Date: Sun, 19 Oct 2025 23:57:20 +0200 Subject: [PATCH] feat(reads): include marked-as-read-only items in /me/reads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If an article or URL is marked as read (📚) but has no reading progress event yet, include it in the reads list so the 'completed' filter surfaces it. Uses readingProgressController.getMarkedAsReadIds() to synthesize ReadItems for marked-only entries. --- src/components/Me.tsx | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/components/Me.tsx b/src/components/Me.tsx index b606854c..098b5a91 100644 --- a/src/components/Me.tsx +++ b/src/components/Me.tsx @@ -167,6 +167,22 @@ const Me: React.FC = ({ readingTimestamp: Math.floor(Date.now() / 1000) })) + // Include items that are only marked-as-read (no progress event yet) + const markedIds = readingProgressController.getMarkedAsReadIds() + for (const id of markedIds) { + if (!readItems.find(i => i.id === id)) { + const isArticle = id.startsWith('naddr1') + readItems.push({ + id, + source: 'marked-as-read', + type: isArticle ? 'article' : 'external', + url: isArticle ? undefined : id, + markedAsRead: true, + readingTimestamp: Math.floor(Date.now() / 1000) + }) + } + } + const readsMap = new Map(readItems.map(item => [item.id, item])) setReadsMap(readsMap) setReads(readItems) @@ -256,7 +272,23 @@ const Me: React.FC = ({ markedAsRead: readingProgressController.isMarkedAsRead(id), readingTimestamp: Math.floor(Date.now() / 1000) })) - + + // Include items that are only marked-as-read (no progress event yet) + const markedIds = readingProgressController.getMarkedAsReadIds() + for (const id of markedIds) { + if (!readItems.find(i => i.id === id)) { + const isArticle = id.startsWith('naddr1') + readItems.push({ + id, + source: 'marked-as-read', + type: isArticle ? 'article' : 'external', + url: isArticle ? undefined : id, + markedAsRead: true, + readingTimestamp: Math.floor(Date.now() / 1000) + }) + } + } + const readsMap = new Map(readItems.map(item => [item.id, item])) setReadsMap(readsMap) setReads(readItems)