From 5ae8c29099837eda00f0ff7c970082adb4612485 Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Fri, 14 Jun 2024 23:37:41 +0900 Subject: [PATCH] =?utf8?q?Cookie=E4=BD=BF=E7=94=A8=E6=99=82=E3=81=AB?= =?utf8?q?=E3=80=8CList=E3=81=AE=E7=99=BA=E8=A8=80=E5=8F=96=E5=BE=97?= =?utf8?q?=E3=81=AB=E5=85=AC=E5=BC=8FRT=E3=82=92=E5=90=AB=E3=82=81?= =?utf8?q?=E3=82=8B=E3=80=8D=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=81=8C=E9=81=A9?= =?utf8?q?=E7=94=A8=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E4=B8=8D=E5=85=B7?= =?utf8?q?=E5=90=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes: 961e4ee8 ("ISocialProtocolClient.GetListTimelineメソッドを追加") --- CHANGELOG.txt | 1 + OpenTween/SocialProtocol/Twitter/TimelineResponseFilter.cs | 8 ++++++++ OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 9fdceda4..a2bf7fda 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,6 +1,7 @@ 更新履歴 ==== Unreleased + * FIX: Cookie使用時に「Listの発言取得に公式RTを含める」の設定が適用されない不具合を修正 ==== Ver 3.15.0(2024/06/14) * NEW: Misskeyでのノート投稿時のファイル添付に対応しました diff --git a/OpenTween/SocialProtocol/Twitter/TimelineResponseFilter.cs b/OpenTween/SocialProtocol/Twitter/TimelineResponseFilter.cs index 01644475..287757c3 100644 --- a/OpenTween/SocialProtocol/Twitter/TimelineResponseFilter.cs +++ b/OpenTween/SocialProtocol/Twitter/TimelineResponseFilter.cs @@ -39,6 +39,8 @@ namespace OpenTween.SocialProtocol.Twitter public bool IsHomeTimeline { get; set; } + public bool IncludeRts { get; set; } = true; + public TimelineResponseFilter(TwitterAccountState accountState) { this.accountState = accountState; @@ -56,6 +58,9 @@ namespace OpenTween.SocialProtocol.Twitter filteredPosts = this.FilterMutedUserPosts(filteredPosts); } + if (!this.IncludeRts) + filteredPosts = this.FilterRetweets(filteredPosts); + return filteredPosts.ToArray(); } @@ -85,5 +90,8 @@ namespace OpenTween.SocialProtocol.Twitter return false; } + + private IEnumerable FilterRetweets(IEnumerable posts) + => posts.Where(x => x.RetweetedId == null); } } diff --git a/OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs b/OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs index 84acb0f5..1c51788c 100644 --- a/OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs +++ b/OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs @@ -33,6 +33,7 @@ using System.Threading.Tasks; using OpenTween.Api.GraphQL; using OpenTween.Api.TwitterV2; using OpenTween.Models; +using OpenTween.Setting; namespace OpenTween.SocialProtocol.Twitter { @@ -177,7 +178,10 @@ namespace OpenTween.SocialProtocol.Twitter 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); -- 2.11.0