From 9981ccfd54e69d5ade6fbe0d1999d357c0529626 Mon Sep 17 00:00:00 2001 From: anhcuky <42137630+anhcuky@users.noreply.github.com> Date: Sun, 5 Jan 2025 04:54:46 +0700 Subject: [PATCH] copy thumbnail URL during crossposting (#2877) --- 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 9235e776..52a90381 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 0ef6fa3f..a3c92306 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 e63e5c1a..e38d305b 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; }