From 68b50a2da0926c8e583a36205509a4873de8137b Mon Sep 17 00:00:00 2001 From: dangered wolf Date: Tue, 31 Jan 2023 13:54:21 -0500 Subject: [PATCH] Fixed display bug with retweet statuses --- src/api.ts | 6 +++++- src/types/twitterTypes.d.ts | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index bf647eb..f05d2a9 100644 --- a/src/api.ts +++ b/src/api.ts @@ -142,7 +142,11 @@ export const statusAPI = async ( event: FetchEvent ): Promise => { const conversation = await fetchConversation(status, event); - const tweet = conversation?.globalObjects?.tweets?.[status] || {}; + let tweet = conversation?.globalObjects?.tweets?.[status] || {}; + + if (tweet.retweeted_status_id_str) { + tweet = conversation?.globalObjects?.tweets?.[tweet.retweeted_status_id_str] || {}; + } /* Fallback for if Tweet did not load */ if (typeof tweet.full_text === 'undefined') { diff --git a/src/types/twitterTypes.d.ts b/src/types/twitterTypes.d.ts index 5a1fb54..279eeff 100644 --- a/src/types/twitterTypes.d.ts +++ b/src/types/twitterTypes.d.ts @@ -149,6 +149,8 @@ type TweetPartial = { source: string; full_text: string; user_id_str: string; + retweeted_status_id: number; + retweeted_status_id_str: string; user?: UserPartial; };