Skip to content

Commit

Permalink
画像投稿時にTwitterMediaIdからstringへの変換が正しく行えてない不具合を修正
Browse files Browse the repository at this point in the history
Fixes: 2456ab1 ("TwitterMediaIdをレコード型として追加")
  • Loading branch information
upsilon committed Jun 14, 2024
1 parent b9987b8 commit 8e0a846
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

==== Unreleased
* FIX: Cookie使用時に「Listの発言取得に公式RTを含める」の設定が適用されない不具合を修正
* FIX: Twitterアカウントでの画像を添付したツイートの投稿がエラーになる不具合を修正

==== Ver 3.15.0(2024/06/14)
* NEW: Misskeyでのノート投稿時のファイル添付に対応しました
Expand Down
3 changes: 2 additions & 1 deletion OpenTween.Tests/Api/GraphQL/CreateTweetRequestTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using Moq;
using OpenTween.Connection;
using OpenTween.Models;
using OpenTween.SocialProtocol.Twitter;
using Xunit;

namespace OpenTween.Api.GraphQL
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions OpenTween/Api/GraphQL/CreateTweetRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
using OpenTween.Api.DataModel;
using OpenTween.Connection;
using OpenTween.Models;
using OpenTween.SocialProtocol.Twitter;

namespace OpenTween.Api.GraphQL
{
Expand All @@ -43,7 +44,7 @@ public class CreateTweetRequest

public TwitterUserId[] ExcludeReplyUserIds { get; set; } = Array.Empty<TwitterUserId>();

public string[] MediaIds { get; set; } = Array.Empty<string>();
public TwitterMediaId[] MediaIds { get; set; } = Array.Empty<TwitterMediaId>();

public string? AttachmentUrl { get; set; }

Expand Down Expand Up @@ -112,7 +113,7 @@ public string CreateRequestBody()
? new(
MediaEntities: this.MediaIds
.Select(x => new VariableMediaEntity(
MediaId: x,
MediaId: x.Id,
TaggedUsers: Array.Empty<string>()
))
.ToArray(),
Expand Down
2 changes: 1 addition & 1 deletion OpenTween/Twitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ await this.SendDirectMessage(param.Text, mediaId)
TweetText = param.Text,
InReplyToTweetId = param.InReplyTo?.StatusId.ToTwitterStatusId(),
ExcludeReplyUserIds = param.ExcludeReplyUserIds.OfType<TwitterUserId>().ToArray(),
MediaIds = param.MediaIds.Select(x => x.ToString()).ToArray(),
MediaIds = param.MediaIds.ToArray(),
AttachmentUrl = param.AttachmentUrl,
};

Expand Down

0 comments on commit 8e0a846

Please sign in to comment.