From 398afe4f10b1516abc09b1b17202cd103f3a848e Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Sat, 15 Jun 2024 02:18:07 +0900 Subject: [PATCH] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2=E3=82=92?= =?UTF-8?q?=E9=96=89=E3=81=98=E3=82=8B=E5=BA=A6=E3=81=ABFollowerIds?= =?UTF-8?q?=E3=81=AA=E3=81=A9=E3=81=8C=E7=A9=BA=E3=81=AE=E7=8A=B6=E6=85=8B?= =?UTF-8?q?=E3=81=AB=E3=83=AA=E3=82=BB=E3=83=83=E3=83=88=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E4=B8=8D=E5=85=B7=E5=90=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: eb7dd7fd ("TwitterAccountStateに FollowerIds, NoRetweetUserIds を追加") --- CHANGELOG.txt | 1 + OpenTween/SocialProtocol/Misskey/MisskeyAccount.cs | 12 ++++-------- .../SocialProtocol/Misskey/MisskeyAccountState.cs | 8 ++++++++ OpenTween/SocialProtocol/Twitter/TwitterAccount.cs | 9 +++------ .../SocialProtocol/Twitter/TwitterAccountState.cs | 6 ++++++ 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b5c6c21b9..01eff36a4 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ ==== Unreleased * FIX: Cookie使用時に「Listの発言取得に公式RTを含める」の設定が適用されない不具合を修正 * FIX: Twitterアカウントでの画像を添付したツイートの投稿がエラーになる不具合を修正 + * FIX: 設定画面を閉じた直後に取得されるツイートが全て両思い表示になる不具合を修正 ==== Ver 3.15.0(2024/06/14) * NEW: Misskeyでのノート投稿時のファイル添付に対応しました 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/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) {