Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

画像投稿時にTwitterMediaIdからstringへの変換が正しく行えてない不具合を修正 #371

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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