This commit is contained in:
Alec Armbruster 2023-06-29 09:56:52 -04:00
parent ad6db69dda
commit bd69d941f1
No known key found for this signature in database
GPG key ID: 52BC7C84E960FD1B

View file

@ -325,10 +325,11 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
}
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 (
<button
@ -345,7 +346,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
/>
</button>
);
} 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 (
<a
className="thumbnail rounded overflow-hidden d-inline-block position-relative p-0 border-0"
@ -360,8 +364,13 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
/>
</a>
);
} else if (url) {
if ((!this.props.hideImage && isVideo(url)) || post.embed_video_url) {
}
// if link to direct/embedded video
if (
url &&
((!this.props.hideImage && isVideo(url)) || post.embed_video_url)
) {
return (
<a
className="text-body"
@ -377,7 +386,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
</div>
</a>
);
} else {
}
// if link to url without metadata image
if (url) {
return (
<a className="text-body" href={url} title={url} rel={relTags}>
<div className="thumbnail rounded bg-light d-flex justify-content-center">
@ -386,7 +398,8 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
</a>
);
}
} else {
// if text-only post
return (
<Link
className="text-body"
@ -399,7 +412,6 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
</Link>
);
}
}
createdLine() {
const post_view = this.postView;