Skip to content

Commit

Permalink
Merge pull request #370 from opentween/fix-include-rts-for-lists
Browse files Browse the repository at this point in the history
Cookie使用時に「Listの発言取得に公式RTを含める」の設定が適用されない不具合を修正
  • Loading branch information
upsilon authored Jun 14, 2024
2 parents cbdbb80 + 5ae8c29 commit b9987b8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
更新履歴

==== Unreleased
* FIX: Cookie使用時に「Listの発言取得に公式RTを含める」の設定が適用されない不具合を修正

==== Ver 3.15.0(2024/06/14)
* NEW: Misskeyでのノート投稿時のファイル添付に対応しました
Expand Down
8 changes: 8 additions & 0 deletions OpenTween/SocialProtocol/Twitter/TimelineResponseFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -56,6 +58,9 @@ public PostClass[] Run(PostClass[] posts)
filteredPosts = this.FilterMutedUserPosts(filteredPosts);
}

if (!this.IncludeRts)
filteredPosts = this.FilterRetweets(filteredPosts);

return filteredPosts.ToArray();
}

Expand Down Expand Up @@ -85,5 +90,8 @@ private bool IsMutedPost(PostClass post)

return false;
}

private IEnumerable<PostClass> FilterRetweets(IEnumerable<PostClass> posts)
=> posts.Where(x => x.RetweetedId == null);
}
}
6 changes: 5 additions & 1 deletion OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
using OpenTween.Api.GraphQL;
using OpenTween.Api.TwitterV2;
using OpenTween.Models;
using OpenTween.Setting;

namespace OpenTween.SocialProtocol.Twitter
{
Expand Down Expand Up @@ -177,7 +178,10 @@ public async Task<TimelineResponse> 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);
Expand Down

0 comments on commit b9987b8

Please sign in to comment.