diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c5ecdc3d6..25f08b59e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,10 @@ 更新履歴 +==== Ver 3.15.1(2024/06/15) + * FIX: Cookie使用時に「Listの発言取得に公式RTを含める」の設定が適用されない不具合を修正 + * FIX: Twitterアカウントでの画像を添付したツイートの投稿がエラーになる不具合を修正 + * FIX: 設定画面を閉じた直後に取得されるツイートが全て両思い表示になる不具合を修正 + ==== Ver 3.15.0(2024/06/14) * NEW: Misskeyでのノート投稿時のファイル添付に対応しました - 追加で必要な権限があるため、前バージョンから使用している Misskey アカウントは再度追加し直す必要があります diff --git a/OpenTween.Tests/Api/GraphQL/CreateTweetRequestTest.cs b/OpenTween.Tests/Api/GraphQL/CreateTweetRequestTest.cs index e6c843f49..87d48597a 100644 --- a/OpenTween.Tests/Api/GraphQL/CreateTweetRequestTest.cs +++ b/OpenTween.Tests/Api/GraphQL/CreateTweetRequestTest.cs @@ -23,6 +23,7 @@ using Moq; using OpenTween.Connection; using OpenTween.Models; +using OpenTween.SocialProtocol.Twitter; using Xunit; namespace OpenTween.Api.GraphQL @@ -104,7 +105,7 @@ public async Task Send_MediaTest() var request = new CreateTweetRequest { TweetText = "tetete", - MediaIds = new[] { "11111", "22222" }, + MediaIds = new TwitterMediaId[] { new("11111"), new("22222") }, }; await request.Send(mock.Object); mock.VerifyAll(); diff --git a/OpenTween/Api/GraphQL/CreateTweetRequest.cs b/OpenTween/Api/GraphQL/CreateTweetRequest.cs index b268cb83a..d91da2527 100644 --- a/OpenTween/Api/GraphQL/CreateTweetRequest.cs +++ b/OpenTween/Api/GraphQL/CreateTweetRequest.cs @@ -30,6 +30,7 @@ using OpenTween.Api.DataModel; using OpenTween.Connection; using OpenTween.Models; +using OpenTween.SocialProtocol.Twitter; namespace OpenTween.Api.GraphQL { @@ -43,7 +44,7 @@ public class CreateTweetRequest public TwitterUserId[] ExcludeReplyUserIds { get; set; } = Array.Empty(); - public string[] MediaIds { get; set; } = Array.Empty(); + public TwitterMediaId[] MediaIds { get; set; } = Array.Empty(); public string? AttachmentUrl { get; set; } @@ -112,7 +113,7 @@ public string CreateRequestBody() ? new( MediaEntities: this.MediaIds .Select(x => new VariableMediaEntity( - MediaId: x, + MediaId: x.Id, TaggedUsers: Array.Empty() )) .ToArray(), diff --git a/OpenTween/Properties/AssemblyInfo.cs b/OpenTween/Properties/AssemblyInfo.cs index ef93077e6..07de06399 100644 --- a/OpenTween/Properties/AssemblyInfo.cs +++ b/OpenTween/Properties/AssemblyInfo.cs @@ -22,7 +22,7 @@ // 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です [assembly: Guid("2d0ae0ba-adac-49a2-9b10-26fd69e695bf")] -[assembly: AssemblyVersion("3.15.0.0")] +[assembly: AssemblyVersion("3.15.1.0")] [assembly: InternalsVisibleTo("OpenTween.Tests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // for Moq diff --git a/OpenTween/Properties/Resources.Designer.cs b/OpenTween/Properties/Resources.Designer.cs index 1ad0d302d..3e46ef6e2 100644 --- a/OpenTween/Properties/Resources.Designer.cs +++ b/OpenTween/Properties/Resources.Designer.cs @@ -625,20 +625,21 @@ internal static string ChangeIconToolStripMenuItem_Confirm { /// /// 更新履歴 /// + ///==== Ver 3.15.1(2024/06/15) + /// * FIX: Cookie使用時に「Listの発言取得に公式RTを含める」の設定が適用されない不具合を修正 + /// * FIX: Twitterアカウントでの画像を添付したツイートの投稿がエラーになる不具合を修正 + /// * FIX: 設定画面を閉じた直後に取得されるツイートが全て両思い表示になる不具合を修正 + /// ///==== Ver 3.15.0(2024/06/14) /// * NEW: Misskeyでのノート投稿時のファイル添付に対応しました /// - 追加で必要な権限があるため、前バージョンから使用している Misskey アカウントは再度追加し直す必要があります /// * FIX: Favoritesタブが空のまま更新されない不具合を修正 /// * FIX: 検索タブのクエリ入力欄で日本語入力をオンにできない不具合を修正 - /// + /// ///==== Ver 3.14.0(2024/06/11) /// * NEW: メインアカウント以外のホームタイムライン表示に対応 /// - タブ単位で切り替わるマルチアカウント機能です - /// - 投稿欄やふぁぼ・RT等の機能も表示中のタブに連動して使用するアカウントが変わります - /// - 現時点ではメインアカウント以外のタブ設定は次回起動時に保持されません - /// * NEW: Misskeyアカウントのホームタイムライン表示・投稿に対応しました - /// - 現時点では Misskey アカウントをメインに設定することはできません - /// - MFMの表示には対応していません [残りの文字列は切り詰められました]"; に類似しているローカライズされた文字列を検索します。 + /// - 投稿欄やふぁぼ・ [残りの文字列は切り詰められました]"; に類似しているローカライズされた文字列を検索します。 /// internal static string ChangeLog { get { diff --git a/OpenTween/SocialProtocol/Misskey/MisskeyAccount.cs b/OpenTween/SocialProtocol/Misskey/MisskeyAccount.cs index 3aed2b624..c1fe6b12e 100644 --- a/OpenTween/SocialProtocol/Misskey/MisskeyAccount.cs +++ b/OpenTween/SocialProtocol/Misskey/MisskeyAccount.cs @@ -42,7 +42,7 @@ ISocialProtocolClient ISocialAccount.Client public bool IsDisposed { get; private set; } - public MisskeyAccountState AccountState { get; private set; } = new(); + public MisskeyAccountState AccountState { get; } = new(); ISocialAccountState ISocialAccount.AccountState => this.AccountState; @@ -71,14 +71,10 @@ public void Initialize(UserAccount accountSettings, SettingCommon settingCommon) { Debug.Assert(accountSettings.UniqueKey == this.UniqueKey.Id, "UniqueKey must be same as current value."); - var serverUri = new Uri($"https://{accountSettings.ServerHostname}/"); - this.AccountState = new(serverUri, new(accountSettings.UserId), accountSettings.Username) - { - AuthorizedScopes = accountSettings.Scopes, - HasUnrecoverableError = false, - }; + this.AccountState.UpdateFromSettings(accountSettings); + this.AccountState.HasUnrecoverableError = false; - var apiBaseUri = new Uri(serverUri, "/api/"); + var apiBaseUri = new Uri(this.AccountState.ServerUri, "/api/"); var newConnection = new MisskeyApiConnection(apiBaseUri, accountSettings.TokenSecret, this.AccountState); (this.connection, var oldConnection) = (newConnection, this.connection); diff --git a/OpenTween/SocialProtocol/Misskey/MisskeyAccountState.cs b/OpenTween/SocialProtocol/Misskey/MisskeyAccountState.cs index 972f54c2d..483e24d75 100644 --- a/OpenTween/SocialProtocol/Misskey/MisskeyAccountState.cs +++ b/OpenTween/SocialProtocol/Misskey/MisskeyAccountState.cs @@ -68,6 +68,14 @@ public MisskeyAccountState(Uri serverUri, MisskeyUserId userId, string userName) this.UserName = userName; } + public void UpdateFromSettings(UserAccount accountSettings) + { + this.ServerUri = new($"https://{accountSettings.ServerHostname}/"); + this.UserId = new(accountSettings.UserId); + this.UserName = accountSettings.Username; + this.AuthorizedScopes = accountSettings.Scopes; + } + /// ユーザー情報を更新します public void UpdateFromUser(MisskeyUser self) { diff --git a/OpenTween/SocialProtocol/Twitter/TimelineResponseFilter.cs b/OpenTween/SocialProtocol/Twitter/TimelineResponseFilter.cs index 016444752..287757c34 100644 --- a/OpenTween/SocialProtocol/Twitter/TimelineResponseFilter.cs +++ b/OpenTween/SocialProtocol/Twitter/TimelineResponseFilter.cs @@ -39,6 +39,8 @@ public class TimelineResponseFilter public bool IsHomeTimeline { get; set; } + public bool IncludeRts { get; set; } = true; + public TimelineResponseFilter(TwitterAccountState accountState) { this.accountState = accountState; @@ -56,6 +58,9 @@ public PostClass[] Run(PostClass[] posts) filteredPosts = this.FilterMutedUserPosts(filteredPosts); } + if (!this.IncludeRts) + filteredPosts = this.FilterRetweets(filteredPosts); + return filteredPosts.ToArray(); } @@ -85,5 +90,8 @@ private bool IsMutedPost(PostClass post) return false; } + + private IEnumerable FilterRetweets(IEnumerable posts) + => posts.Where(x => x.RetweetedId == null); } } diff --git a/OpenTween/SocialProtocol/Twitter/TwitterAccount.cs b/OpenTween/SocialProtocol/Twitter/TwitterAccount.cs index aac7607f8..03a17c8e3 100644 --- a/OpenTween/SocialProtocol/Twitter/TwitterAccount.cs +++ b/OpenTween/SocialProtocol/Twitter/TwitterAccount.cs @@ -41,7 +41,7 @@ public string AccountType public bool IsDisposed { get; private set; } - public TwitterAccountState AccountState { get; private set; } = new(); + public TwitterAccountState AccountState { get; } = new(); ISocialAccountState ISocialAccount.AccountState => this.AccountState; @@ -72,12 +72,9 @@ public void Initialize(UserAccount accountSettings, SettingCommon settingCommon) Debug.Assert(accountSettings.UniqueKey == this.UniqueKey.Id, "UniqueKey must be same as current value."); var credential = accountSettings.GetTwitterCredential(); - var userId = new TwitterUserId(accountSettings.UserId); - this.AccountState = new TwitterAccountState(userId, accountSettings.Username) - { - HasUnrecoverableError = credential is TwitterCredentialNone, - }; + this.AccountState.UpdateFromSettings(accountSettings); + this.AccountState.HasUnrecoverableError = credential is TwitterCredentialNone; var newConnection = new TwitterApiConnection(credential, this.AccountState); (this.apiConnection, var oldConnection) = (newConnection, this.apiConnection); diff --git a/OpenTween/SocialProtocol/Twitter/TwitterAccountState.cs b/OpenTween/SocialProtocol/Twitter/TwitterAccountState.cs index edda96541..63bd60802 100644 --- a/OpenTween/SocialProtocol/Twitter/TwitterAccountState.cs +++ b/OpenTween/SocialProtocol/Twitter/TwitterAccountState.cs @@ -73,6 +73,12 @@ public TwitterAccountState(TwitterUserId userId, string userName) this.UserName = userName; } + public void UpdateFromSettings(UserAccount accountSettings) + { + this.UserId = new(accountSettings.UserId); + this.UserName = accountSettings.Username; + } + /// ユーザー情報を更新します public void UpdateFromUser(TwitterUser self) { diff --git a/OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs b/OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs index 84acb0f59..1c51788c1 100644 --- a/OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs +++ b/OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs @@ -33,6 +33,7 @@ using OpenTween.Api.GraphQL; using OpenTween.Api.TwitterV2; using OpenTween.Models; +using OpenTween.Setting; namespace OpenTween.SocialProtocol.Twitter { @@ -177,7 +178,10 @@ public async Task GetListTimeline(long listId, int count, IQue var posts = this.account.Legacy.CreatePostsFromJson(statuses, firstLoad); - var filter = new TimelineResponseFilter(this.account.AccountState); + var filter = new TimelineResponseFilter(this.account.AccountState) + { + IncludeRts = SettingManager.Instance.Common.IsListsIncludeRts, + }; posts = filter.Run(posts); return new(posts, cursorTop, cursorBottom); diff --git a/OpenTween/Twitter.cs b/OpenTween/Twitter.cs index b014d068b..0d1458bb2 100644 --- a/OpenTween/Twitter.cs +++ b/OpenTween/Twitter.cs @@ -228,7 +228,7 @@ await this.SendDirectMessage(param.Text, mediaId) TweetText = param.Text, InReplyToTweetId = param.InReplyTo?.StatusId.ToTwitterStatusId(), ExcludeReplyUserIds = param.ExcludeReplyUserIds.OfType().ToArray(), - MediaIds = param.MediaIds.Select(x => x.ToString()).ToArray(), + MediaIds = param.MediaIds.ToArray(), AttachmentUrl = param.AttachmentUrl, }; diff --git a/appveyor.yml b/appveyor.yml index c4aac59fd..37068386b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 3.14.0.{build} +version: 3.15.0.{build} os: Visual Studio 2022