From 2623271c6562b5c65d03ea23a270120c6f21185d Mon Sep 17 00:00:00 2001 From: Vincent Cloutier Date: Sat, 14 Jan 2023 11:16:21 -0500 Subject: [PATCH] fix replies --- src/BirdsiteLive.Twitter/TwitterTweetsService.cs | 2 +- src/Tests/BirdsiteLive.Twitter.Tests/TweetTests.cs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/BirdsiteLive.Twitter/TwitterTweetsService.cs b/src/BirdsiteLive.Twitter/TwitterTweetsService.cs index fdd603c..af14ce9 100644 --- a/src/BirdsiteLive.Twitter/TwitterTweetsService.cs +++ b/src/BirdsiteLive.Twitter/TwitterTweetsService.cs @@ -69,7 +69,7 @@ namespace BirdsiteLive.Twitter var timeline = tweet.RootElement.GetProperty("data").GetProperty("threaded_conversation_with_injections_v2") .GetProperty("instructions").EnumerateArray().First().GetProperty("entries").EnumerateArray(); - return await Extract( timeline.First() ); + return await Extract( timeline.Where(x => x.GetProperty("entryId").GetString() == "tweet-" + statusId).ToArray().First() ); } catch (Exception e) { diff --git a/src/Tests/BirdsiteLive.Twitter.Tests/TweetTests.cs b/src/Tests/BirdsiteLive.Twitter.Tests/TweetTests.cs index 0fd3bdd..6a3fe71 100644 --- a/src/Tests/BirdsiteLive.Twitter.Tests/TweetTests.cs +++ b/src/Tests/BirdsiteLive.Twitter.Tests/TweetTests.cs @@ -83,5 +83,15 @@ namespace BirdsiteLive.ActivityPub.Tests Assert.AreEqual(tweet.MessageContent, "When you gave them your keys you gave them your coins.\nhttps://twitter.com/kadhim/status/1610706613207285773"); } + + [TestMethod] + public async Task SimpleReply() + { + var tweet = await _tweetService.GetTweetAsync(1445468404815597573); + + Assert.AreEqual(tweet.InReplyToAccount, "punk6529"); + Assert.AreEqual(tweet.InReplyToStatusId, 1445468401745289235); + Assert.IsTrue(tweet.IsReply); + } } }