Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Harm133 2026-01-24 22:19:49 +01:00 committed by GitHub
parent 44e700c7ae
commit 7b48da6802
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View File

@ -228,15 +228,15 @@ def fetch_channel(ucid, pull_all_videos : Bool)
# If there is no update for the video, only update the views # If there is no update for the video, only update the views
if database_video.size > 0 && updated == database_video[0].updated if database_video.size > 0 && updated == database_video[0].updated
video = database_video[0] video = database_video[0]
video.views = views video.views = views
else else
channel_video = videos channel_video = videos
.select(SearchVideo) .select(SearchVideo)
.select(&.id.== video_id)[0]? .select(&.id.== video_id)[0]?
# Not a video, either a short of a livestream # Not a video, either a short or a livestream
# Fetch invididual for info # Fetch individual for info
if channel_video.nil? if channel_video.nil?
short_or_live = fetch_video(video_id, "") short_or_live = fetch_video(video_id, "")
video_type = short_or_live.video_type video_type = short_or_live.video_type

View File

@ -438,7 +438,7 @@ module Invidious::Routes::Feeds
live_now: video.live_now, live_now: video.live_now,
premiere_timestamp: video.premiere_timestamp, premiere_timestamp: video.premiere_timestamp,
views: video.views, views: video.views,
video_type: VideoType::Video video_type: video.video_type
}) })
was_insert = Invidious::Database::ChannelVideos.insert(video, with_premiere_timestamp: true) was_insert = Invidious::Database::ChannelVideos.insert(video, with_premiere_timestamp: true)

View File

@ -33,6 +33,8 @@ def get_subscription_feed(user, max_results = 40, page = 1)
if user.preferences.hide_shorts if user.preferences.hide_shorts
types_to_fetch.delete(VideoType::Short) types_to_fetch.delete(VideoType::Short)
end end
# Note: hide_livestreams also hides scheduled/premiere videos (VideoType::Scheduled),
# since they are typically upcoming livestreams.
if user.preferences.hide_livestreams if user.preferences.hide_livestreams
[VideoType::Livestream, VideoType::Scheduled].each { |v| types_to_fetch.delete(v) } [VideoType::Livestream, VideoType::Scheduled].each { |v| types_to_fetch.delete(v) }
end end