From d6a0579deb53368e641e9bb9ffbd32cc2cdbf7bb Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Sat, 25 May 2024 10:00:12 +0900 Subject: [PATCH] =?utf8?q?ISocialProtocolClient.DeletePost=E3=83=A1?= =?utf8?q?=E3=82=BD=E3=83=83=E3=83=89=E3=81=A7DM=E3=81=AE=E5=89=8A?= =?utf8?q?=E9=99=A4=E3=81=AB=E5=AF=BE=E5=BF=9C=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs | 7 +++++++ OpenTween/SocialProtocol/Twitter/TwitterV1Client.cs | 7 +++++++ OpenTween/Tween.cs | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs b/OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs index 6e4a9cc3..14c49691 100644 --- a/OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs +++ b/OpenTween/SocialProtocol/Twitter/TwitterGraphqlClient.cs @@ -236,6 +236,13 @@ namespace OpenTween.SocialProtocol.Twitter public async Task DeletePost(PostId postId) { + if (postId is TwitterDirectMessageId dmId) + { + await this.account.Legacy.Api.DirectMessagesEventsDestroy(dmId) + .ConfigureAwait(false); + return; + } + var statusId = this.AssertTwitterStatusId(postId); var request = new DeleteTweetRequest { diff --git a/OpenTween/SocialProtocol/Twitter/TwitterV1Client.cs b/OpenTween/SocialProtocol/Twitter/TwitterV1Client.cs index 2918ec97..0cd7eadd 100644 --- a/OpenTween/SocialProtocol/Twitter/TwitterV1Client.cs +++ b/OpenTween/SocialProtocol/Twitter/TwitterV1Client.cs @@ -189,6 +189,13 @@ namespace OpenTween.SocialProtocol.Twitter public async Task DeletePost(PostId postId) { + if (postId is TwitterDirectMessageId dmId) + { + await this.account.Legacy.Api.DirectMessagesEventsDestroy(dmId) + .ConfigureAwait(false); + return; + } + var statusId = this.AssertTwitterStatusId(postId); await this.account.Legacy.Api.StatusesDestroy(statusId) diff --git a/OpenTween/Tween.cs b/OpenTween/Tween.cs index 91de34f6..1ae93040 100644 --- a/OpenTween/Tween.cs +++ b/OpenTween/Tween.cs @@ -2197,9 +2197,9 @@ namespace OpenTween try { - if (post.StatusId is TwitterDirectMessageId dmId) + if (post.IsDm) { - await this.tw.Api.DirectMessagesEventsDestroy(dmId); + await this.CurrentTabAccount.Client.DeletePost(post.StatusId); } else { -- 2.11.0