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).
This commit is contained in:
Ricardo
2026-02-23 10:40:14 +01:00
parent a7bc472e87
commit 1bc6aaa0a5
+12
View File
@@ -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 // Add webmention-io items, skipping duplicates
for (const wm of wmItems) { for (const wm of wmItems) {
const key = wm['wm-id']; const key = wm['wm-id'];
if (seen.has(key)) continue; if (seen.has(key)) continue;
// Also skip if same source URL exists in conversations // Also skip if same source URL exists in conversations
if (wm.url && convUrls.has(wm.url)) continue; 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); seen.add(key);
allChildren.push(wm); allChildren.push(wm);
} }