Comments (7)
That logic can def be cleaned up, the blame is entirely on me š
I can fix this, however this issue exposes an edge case we haven't considered: what should the thumbnail look like when a thumbnail URL is defined and the URL is a video?
IMO if the thumbnail is defined, that should always be preferred.
from lemmy-ui.
Hrm... makes sense I think, up to you tho.
from lemmy-ui.
It doesn't seem to be reproducible by posting the same link directly on voyager.lemmy.ml: https://voyager.lemmy.ml/post/100387
from lemmy-ui.
Comparing the JSON .post_view.post
of both posts returned by the API:
diff
diff --git a/dev/fd/11 b/dev/fd/13
--- a/dev/fd/11
+++ b/dev/fd/13
@@ -1,17 +1,16 @@
{
- "id": 78810,
- "name": "Tried this with my wife, she gave me back change",
+ "id": 100387,
+ "name": "ui#2418",
"url": "https://files.catbox.moe/oytdpp.mp4",
- "creator_id": 15834,
- "community_id": 65938,
+ "creator_id": 181570,
+ "community_id": 67912,
"removed": false,
"locked": false,
- "published": "2024-04-02T23:18:35.954737Z",
+ "published": "2024-04-26T23:09:20.321778Z",
"deleted": false,
"nsfw": false,
- "thumbnail_url": "https://files.catbox.moe/oytdpp.mp4",
- "ap_id": "https://sh.itjust.works/post/17246485",
- "local": false,
+ "ap_id": "https://voyager.lemmy.ml/post/100387",
+ "local": true,
"language_id": 37,
"featured_community": false,
"featured_local": false,
post_view.post.thumbnail_url
is present and pointing to the mp4 on the broken post.
from lemmy-ui.
I just tried to reproduce your error locally using the latest changes on main. I was unable to do so. Considering the original post on shitjustworks works (no wordplay intended) and the post that got federated to voyager doesn't work, this could be a federation issue, or an issue of incompatibility between 0.19.3 and the beta releases.
To help narrow down the issue, could you try posting from voyager to a federated community? Also worth trying to post in a community that's local to voyager but federated with another instance and viewing that post from the federated instance's side.
from lemmy-ui.
I think I found the issue digging around in the code. Determining the thumbnail is handled in this function with a terrifying jungle of if/else statements. Here's the most relevant lines:
// this.imageSrc uses thumbnail as its src if it exists
} else if (!this.props.hideImage && url && thumbnail && this.imageSrc) {
return (
<a
className="thumbnail rounded overflow-hidden d-inline-block position-relative p-0 border-0"
href={url}
rel={relTags}
title={url}
target={this.linkTarget}
>
{this.imgThumb(this.imageSrc)}
<Icon
icon="external-link"
classes="d-block text-white position-absolute end-0 top-0 mini-overlay text-opacity-75 text-opacity-100-hover"
/>
</a>
);
} else if (url) {
if ((!this.props.hideImage && isVideo(url)) || post.embed_video_url) {
return (
<a
className="text-body"
href={url}
title={url}
rel={relTags}
data-tippy-content={I18NextService.i18n.t("expand_here")}
onClick={linkEvent(this, this.handleImageExpandClick)}
aria-label={I18NextService.i18n.t("expand_here")}
target={this.linkTarget}
>
<div className="thumbnail rounded bg-light d-flex justify-content-center">
<Icon icon="play" classes="d-flex align-items-center" />
</div>
</a>
);
} else {
If a thumbnail URL is defined, it will reach the condition before the video icon thumbnail, causing a link thumbnail with a broken image like the post on voyager.
I can fix this, however this issue exposes an edge case we haven't considered: what should the thumbnail look like when a thumbnail URL is defined and the URL is a video?
from lemmy-ui.
Should I still include the little video symbol watermark icon when the thumbnail is defined?
from lemmy-ui.
Related Issues (20)
- [Bug]: Link of comment is the link to the parent HOT 1
- Code blocks follow browser light/dark theme, not user settings HOT 1
- When delete button is in dropdown menu, the menu disappears before completion HOT 4
- Lemmy uses a lot of space in the browser, up to 1GB
- [Bug]: Export fails HOT 9
- 'External link' and 'image' icons are too similar HOT 1
- Web gui should indicate whether Iām logged in
- appoint moderator confirmation dialog has incorrect text HOT 2
- Fallback image for when images are broken
- [Bug]: Saved Posts RSS Using Posts Feed HOT 4
- [Bug] Sending Direct Message fails `0.19.4-beta.5` HOT 2
- Cake days are 1 day off on leap years HOT 1
- Mod actions not available until reload when creating a new community
- Show own comments at the top
- Hashtags in titles not displaying nicely.
- ability for admins to view all local users
- Site logo disappearing HOT 22
- Dependency Dashboard
- Show corresponding modlog entry when viewing deleted posts/comments
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lemmy-ui.