From b3c288a590e37a9bc16858b62176f2ba7be25341 Mon Sep 17 00:00:00 2001 From: Mattias Tall Date: Tue, 26 May 2026 12:16:43 +0200 Subject: [PATCH] Fix channel avatar: include channel_thumbnail_url in video response Reading from the channels query cache was unreliable (cache might not be loaded, or channel not followed). Add c.thumbnail_url AS channel_thumbnail_url to _VIDEO_SELECT so every video response carries its channel avatar directly. VideoCard uses it with cache as fallback. Co-Authored-By: Claude Sonnet 4.6 --- backend/routers/videos.py | 2 ++ frontend/src/components/VideoCard.jsx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/routers/videos.py b/backend/routers/videos.py index 3110d6f..b643821 100644 --- a/backend/routers/videos.py +++ b/backend/routers/videos.py @@ -68,6 +68,7 @@ class VideoDetail(BaseModel): view_count: Optional[int] = None like_count: Optional[int] = None dislike_count: Optional[int] = None + channel_thumbnail_url: Optional[str] = None model_config = {"from_attributes": True} @@ -426,6 +427,7 @@ _VIDEO_SELECT = """ SELECT v.id, v.youtube_video_id, v.title, v.description, v.thumbnail_url, v.duration_seconds, v.published_at, v.tags, v.category, v.view_count, v.like_count, v.dislike_count, c.id AS channel_id, c.name AS channel_name, c.youtube_channel_id AS channel_youtube_id, + c.thumbnail_url AS channel_thumbnail_url, COALESCE(uv.watched, 0) AS watched, COALESCE(uv.watch_progress_seconds, 0) AS watch_progress_seconds, COALESCE(uv.downloaded, 0) AS is_downloaded, diff --git a/frontend/src/components/VideoCard.jsx b/frontend/src/components/VideoCard.jsx index e1b394b..bc21dfe 100644 --- a/frontend/src/components/VideoCard.jsx +++ b/frontend/src/components/VideoCard.jsx @@ -314,7 +314,7 @@ export default function VideoCard({ video, size = "md", onDismiss, variant = "gr } // ── Grid variant ───────────────────────────────────────────────────────── - const avatarUrl = channelMeta?.thumbnail_url ?? null; + const avatarUrl = video.channel_thumbnail_url ?? channelMeta?.thumbnail_url ?? null; const avatarLetter = video.channel_name?.[0]?.toUpperCase() ?? "?"; return (