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 <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user