Skip to content

Commit

Permalink
Merge branch 'develop' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
upsilon committed Jul 5, 2023
2 parents b0f5451 + ba57cfa commit 57fa9fa
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
23 changes: 14 additions & 9 deletions OpenTween/Api/GraphQL/TimelineTweet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,7 @@ public TwitterStatus ToTwitterStatus()
try
{
var resultElm = this.Element.Element("tweet_results")?.Element("result") ?? throw CreateParseError();
var tweetElm = resultElm.Element("__typename")?.Value switch
{
"Tweet" => resultElm,
"TweetWithVisibilityResults" => resultElm.Element("tweet") ?? throw CreateParseError(),
_ => throw CreateParseError(),
};

return this.ParseTweet(tweetElm);
return this.ParseTweetUnion(resultElm);
}
catch (WebApiException ex)
{
Expand All @@ -69,6 +62,18 @@ public TwitterStatus ToTwitterStatus()
}
}

private TwitterStatus ParseTweetUnion(XElement tweetUnionElm)
{
var tweetElm = tweetUnionElm.Element("__typename")?.Value switch
{
"Tweet" => tweetUnionElm,
"TweetWithVisibilityResults" => tweetUnionElm.Element("tweet") ?? throw CreateParseError(),
_ => throw CreateParseError(),
};

return this.ParseTweet(tweetElm);
}

private TwitterStatus ParseTweet(XElement tweetElm)
{
var tweetLegacyElm = tweetElm.Element("legacy") ?? throw CreateParseError();
Expand Down Expand Up @@ -142,7 +147,7 @@ static string GetText(XElement elm, string name)
ScreenName = GetText(userLegacyElm, "screen_name"),
Protected = GetTextOrNull(userLegacyElm, "protected") == "true",
},
RetweetedStatus = retweetedTweetElm != null ? this.ParseTweet(retweetedTweetElm) : null,
RetweetedStatus = retweetedTweetElm != null ? this.ParseTweetUnion(retweetedTweetElm) : null,
};
}

Expand Down
2 changes: 1 addition & 1 deletion OpenTween/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
[assembly: Guid("2d0ae0ba-adac-49a2-9b10-26fd69e695bf")]

[assembly: AssemblyVersion("3.6.1.0")]
[assembly: AssemblyVersion("3.6.2.0")]

[assembly: InternalsVisibleTo("OpenTween.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // for Moq
7 changes: 4 additions & 3 deletions OpenTween/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions OpenTween/Resources/ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
更新履歴

==== Ver 3.6.2(2023/07/07)
* FIX: リプライ制限されたツイートのRTがリストのタイムラインに含まれているとエラーになる不具合を修正

==== Ver 3.6.1(2023/07/07)
* CHG: graphqlエンドポイントからのレスポンスの読み込み失敗時に問題の起きたツイートをErrorLogsに書き出す機能を追加
* FIX: リプライ制限されたツイートがリストのタイムラインに含まれているとエラーになる不具合を修正 (thx @wal_san!)
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 3.6.0.{build}
version: 3.6.1.{build}

os: Visual Studio 2022

Expand Down

0 comments on commit 57fa9fa

Please sign in to comment.