From 1bc6aaa0a5f92532325dcc4b4ca751fdfe0bf351 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Mon, 23 Feb 2026 10:40:14 +0100 Subject: [PATCH] fix: add author-based dedup to client-side webmentions The client-side webmentions.js was deduplicating by wm-id and source URL, but conversations API and webmention.io use different ID formats (string vs numeric). Add author URL + action type dedup to catch cross-source duplicates (e.g., same Bluesky like reported by both). --- js/webmentions.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/webmentions.js b/js/webmentions.js index 145840e..bd1585f 100644 --- a/js/webmentions.js +++ b/js/webmentions.js @@ -142,12 +142,24 @@ } } + // Build set of author+action keys from conversations for cross-source dedup + const authorActions = new Set(); + for (const wm of convItems) { + const authorUrl = (wm.author && wm.author.url) || wm.url || ''; + const action = wm['wm-property'] || 'mention'; + if (authorUrl) authorActions.add(authorUrl + '::' + action); + } + // Add webmention-io items, skipping duplicates for (const wm of wmItems) { const key = wm['wm-id']; if (seen.has(key)) continue; // Also skip if same source URL exists in conversations if (wm.url && convUrls.has(wm.url)) continue; + // Skip if same author + same action type already from conversations + const authorUrl = (wm.author && wm.author.url) || wm.url || ''; + const action = wm['wm-property'] || 'mention'; + if (authorUrl && authorActions.has(authorUrl + '::' + action)) continue; seen.add(key); allChildren.push(wm); }