fix IsThread
This commit is contained in:
parent
6b01cd305c
commit
c4e6414229
2 changed files with 18 additions and 2 deletions
|
@ -179,6 +179,10 @@ namespace BirdsiteLive.Twitter
|
|||
string inReplyToUser = null;
|
||||
long? inReplyToPostId = null;
|
||||
|
||||
string userName = tweet.GetProperty("content").GetProperty("itemContent")
|
||||
.GetProperty("tweet_results").GetProperty("result").GetProperty("core").GetProperty("user_results")
|
||||
.GetProperty("result").GetProperty("legacy").GetProperty("screen_name").GetString();
|
||||
|
||||
bool isReply = tweet.GetProperty("content").GetProperty("itemContent")
|
||||
.GetProperty("tweet_results").GetProperty("result").GetProperty("legacy")
|
||||
.TryGetProperty("in_reply_to_status_id_str", out inReplyToPostIdElement);
|
||||
|
@ -291,7 +295,7 @@ namespace BirdsiteLive.Twitter
|
|||
MessageContent = MessageContent.Trim(),
|
||||
CreatedAt = DateTime.ParseExact(creationTime, "ddd MMM dd HH:mm:ss yyyy", System.Globalization.CultureInfo.InvariantCulture),
|
||||
IsReply = isReply,
|
||||
IsThread = false,
|
||||
IsThread = userName == inReplyToUser,
|
||||
IsRetweet = isRetweet,
|
||||
Media = Media.Count() == 0 ? null : Media.ToArray(),
|
||||
RetweetUrl = "https://t.co/123",
|
||||
|
|
|
@ -85,13 +85,25 @@ namespace BirdsiteLive.ActivityPub.Tests
|
|||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task SimpleReply()
|
||||
public async Task SimpleThread()
|
||||
{
|
||||
var tweet = await _tweetService.GetTweetAsync(1445468404815597573);
|
||||
|
||||
Assert.AreEqual(tweet.InReplyToAccount, "punk6529");
|
||||
Assert.AreEqual(tweet.InReplyToStatusId, 1445468401745289235);
|
||||
Assert.IsTrue(tweet.IsReply);
|
||||
Assert.IsTrue(tweet.IsThread);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task SimpleReply()
|
||||
{
|
||||
var tweet = await _tweetService.GetTweetAsync(1612622335546363904);
|
||||
|
||||
Assert.AreEqual(tweet.InReplyToAccount, "DriveTeslaca");
|
||||
Assert.AreEqual(tweet.InReplyToStatusId, 1612610060194312193);
|
||||
Assert.IsTrue(tweet.IsReply);
|
||||
Assert.IsFalse(tweet.IsThread);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue