diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 586403be..3ed44de8 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -325,10 +325,11 @@ export class PostListing extends Component { } thumbnail() { - const post = this.postView.post; - const url = post.url; + const { post } = this.postView; + const { url } = post; const thumbnail = post.thumbnail_url; + // if direct image link if (!this.props.hideImage && url && isImage(url) && this.imageSrc) { return ( ); - } else if (!this.props.hideImage && url && thumbnail && this.imageSrc) { + } + + // if link to url with included metadata image + if (!this.props.hideImage && url && thumbnail && this.imageSrc) { return ( { /> ); - } else if (url) { - if ((!this.props.hideImage && isVideo(url)) || post.embed_video_url) { - return ( - -
- -
-
- ); - } else { - return ( - -
- -
-
- ); - } - } else { + } + + // if link to direct/embedded video + if ( + url && + ((!this.props.hideImage && isVideo(url)) || post.embed_video_url) + ) { return ( -
- +
- + ); } + + // if link to url without metadata image + if (url) { + return ( + +
+ +
+
+ ); + } + + // if text-only post + return ( + +
+ +
+ + ); } createdLine() {