From 8e0a8469c15689d6dc2120a418be0c374f0a3352 Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Sat, 15 Jun 2024 01:19:38 +0900 Subject: [PATCH] =?UTF-8?q?=E7=94=BB=E5=83=8F=E6=8A=95=E7=A8=BF=E6=99=82?= =?UTF-8?q?=E3=81=ABTwitterMediaId=E3=81=8B=E3=82=89string=E3=81=B8?= =?UTF-8?q?=E3=81=AE=E5=A4=89=E6=8F=9B=E3=81=8C=E6=AD=A3=E3=81=97=E3=81=8F?= =?UTF-8?q?=E8=A1=8C=E3=81=88=E3=81=A6=E3=81=AA=E3=81=84=E4=B8=8D=E5=85=B7?= =?UTF-8?q?=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: 2456ab12 ("TwitterMediaIdをレコード型として追加") --- CHANGELOG.txt | 1 + OpenTween.Tests/Api/GraphQL/CreateTweetRequestTest.cs | 3 ++- OpenTween/Api/GraphQL/CreateTweetRequest.cs | 5 +++-- OpenTween/Twitter.cs | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index a2bf7fda0..b5c6c21b9 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -2,6 +2,7 @@ ==== Unreleased * FIX: Cookie使用時に「Listの発言取得に公式RTを含める」の設定が適用されない不具合を修正 + * FIX: Twitterアカウントでの画像を添付したツイートの投稿がエラーになる不具合を修正 ==== Ver 3.15.0(2024/06/14) * NEW: 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/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, };