mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Show the original tweet firstly
This commit is contained in:
parent
5d70d04154
commit
08c30f9c24
1 changed files with 7 additions and 9 deletions
|
|
@ -150,6 +150,12 @@ export class TwitterHandler extends ContentHandler {
|
|||
throw new Error('could not find tweet id in url')
|
||||
}
|
||||
let tweet = await getTweetById(tweetId)
|
||||
const conversationId = tweet.data.conversation_id
|
||||
if (conversationId !== tweetId) {
|
||||
// this is a reply, so we need to get the referenced tweet
|
||||
tweet = await getTweetById(conversationId)
|
||||
}
|
||||
|
||||
const tweetData = tweet.data
|
||||
const authorId = tweetData.author_id
|
||||
const author = tweet.includes.users.filter((u) => (u.id = authorId))[0]
|
||||
|
|
@ -157,18 +163,10 @@ export class TwitterHandler extends ContentHandler {
|
|||
const title = _.escape(titleForAuthor(author))
|
||||
const authorImage = author.profile_image_url.replace('_normal', '_400x400')
|
||||
const description = _.escape(tweetData.text)
|
||||
const converstationId = tweetData.conversation_id
|
||||
if (converstationId !== tweetId) {
|
||||
// this is a reply, so we need to get the referenced tweet
|
||||
tweet = await getTweetById(converstationId)
|
||||
}
|
||||
|
||||
const tweets = [tweet]
|
||||
// we want to get the full thread
|
||||
const thread = await getTweetThread(
|
||||
tweetData.conversation_id,
|
||||
author.username
|
||||
)
|
||||
const thread = await getTweetThread(conversationId, author.username)
|
||||
if (thread.meta.result_count > 0) {
|
||||
// tweets are in reverse chronological order in the thread
|
||||
for (const t of thread.data.reverse()) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue