mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-05-15 15:08:51 +02:00
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:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user