From e21aa68509130e3647e0406750e5444f63fdc579 Mon Sep 17 00:00:00 2001 From: anhcuky Date: Tue, 31 Dec 2024 20:54:51 +0700 Subject: [PATCH] copy thumbnail URL during crossposting --- src/shared/components/post/create-post.tsx | 1 + src/shared/components/post/post-listing.tsx | 7 ++++++- src/shared/utils/types/cross-post-params.ts | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/shared/components/post/create-post.tsx b/src/shared/components/post/create-post.tsx index 9235e776b3..52a903817c 100644 --- a/src/shared/components/post/create-post.tsx +++ b/src/shared/components/post/create-post.tsx @@ -206,6 +206,7 @@ export class CreatePost extends Component< altText: locationState.altText, nsfw: locationState.nsfw, languageId: locationState.languageId, + customThumbnailUrl: locationState.customThumbnailUrl, }); this.setState(s => ({ resetCounter: s.resetCounter + 1 })); } diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 0ef6fa3f66..a3c9230663 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -916,7 +916,8 @@ export class PostListing extends Component { } get crossPostParams(): CrossPostParams { - const { name, url, alt_text, nsfw, language_id } = this.postView.post; + const { name, url, alt_text, nsfw, language_id, thumbnail_url } = + this.postView.post; const crossPostParams: CrossPostParams = { name }; if (url) { @@ -940,6 +941,10 @@ export class PostListing extends Component { crossPostParams.languageId = language_id; } + if (thumbnail_url) { + crossPostParams.customThumbnailUrl = thumbnail_url; + } + return crossPostParams; } diff --git a/src/shared/utils/types/cross-post-params.ts b/src/shared/utils/types/cross-post-params.ts index e63e5c1a42..e38d305b76 100644 --- a/src/shared/utils/types/cross-post-params.ts +++ b/src/shared/utils/types/cross-post-params.ts @@ -7,4 +7,5 @@ export default interface CrossPostParams { altText?: string; nsfw?: StringBoolean; languageId?: number; + customThumbnailUrl?: string; }