Fix retweet/reply author mismatch: name and handle now describe the same person

authorName came from fxtwitter's enrichment (keyed by the tweet ID, which
for a retweet/reply resolves to the original tweet) while authorHandle was
hardcoded to the RSS feed's dc:creator — which is actually whichever list
member's retweet or reply surfaced the item, not the original author. The
card ended up showing one person's display name next to another person's
@handle. Both fields now come from the same enrichment response, falling
back together to the RSS-derived handle only when enrichment fails.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014c1L8ghNBFjfiH64UMViP8
This commit is contained in:
Claude
2026-07-23 17:39:05 +00:00
parent b4aade7210
commit d93eb6f1cf
+11 -6
View File
@@ -116,16 +116,21 @@ export const nitterAdapter: SourceAdapter = {
continue; continue;
} }
// dc:creator is reliably the author of this item's own tweet text (rss-parser // dc:creator (rss-parser maps it to item.creator) is actually whichever list
// maps it to item.creator) — for a retweet, that's the original tweet's author, // member's retweet/reply surfaced this item in the feed — NOT the original
// not whichever list member's retweet surfaced it in this feed. // tweet's author for a retweet. It's only used here to look up the fxtwitter
const handle = (item.creator ?? '').replace(/^@/, '') || 'unknown'; // enrichment (fxtwitter needs *a* handle + the tweet ID, and any handle works
// for that lookup); the author identity actually displayed always comes from
// the enrichment response below, keyed consistently off the same tweet — so
// name and handle never end up describing two different people.
const rssHandle = (item.creator ?? '').replace(/^@/, '') || 'unknown';
const ownHtml = ownContentHtml(item.content ?? ''); const ownHtml = ownContentHtml(item.content ?? '');
const rssImageUrl = extractImageUrl(ownHtml); const rssImageUrl = extractImageUrl(ownHtml);
const enrichment = await fetchFxTwitter(handle, tweetId); const enrichment = await fetchFxTwitter(rssHandle, tweetId);
const authorName = enrichment?.author?.name ?? handle; const authorName = enrichment?.author?.name ?? rssHandle;
const handle = enrichment?.author?.screen_name ?? rssHandle;
const avatarUrl = enrichment?.author?.avatar_url ?? null; const avatarUrl = enrichment?.author?.avatar_url ?? null;
const text = enrichment?.text ?? ownHtml; const text = enrichment?.text ?? ownHtml;
// Enrichment failed (or came back with no media) — fall back to the RSS // Enrichment failed (or came back with no media) — fall back to the RSS