mirror of
https://github.com/svemagie/indiekit-endpoint-microsub.git
synced 2026-04-02 15:35:00 +02:00
fix: mark-as-read for items from orphan channels
Items from channels with userId: null (created during earlier setup) appeared in the unified timeline but had no _channelUid, causing the mark-read JS handler to silently abort. Fall back to channelId (MongoDB ObjectId) when channelUid is unavailable, and resolve it server-side via getChannelById. Confab-Link: http://localhost:8080/sessions/4d40ef89-a713-48c1-b4ed-0ffafca25677
This commit is contained in:
@@ -108,7 +108,8 @@
|
||||
|
||||
const itemId = button.dataset.itemId;
|
||||
const channelUid = button.dataset.channelUid;
|
||||
if (!itemId || !channelUid) return;
|
||||
const channelId = button.dataset.channelId;
|
||||
if (!itemId || (!channelUid && !channelId)) return;
|
||||
|
||||
button.disabled = true;
|
||||
|
||||
@@ -116,7 +117,7 @@
|
||||
const formData = new URLSearchParams();
|
||||
formData.append('action', 'timeline');
|
||||
formData.append('method', 'mark_read');
|
||||
formData.append('channel', channelUid);
|
||||
formData.append('channel', channelUid || channelId);
|
||||
formData.append('entry', itemId);
|
||||
|
||||
const response = await fetch(microsubApiUrl, {
|
||||
|
||||
Reference in New Issue
Block a user