Move DB queries related to channels in a separate module

This commit is contained in:
Samantaz Fox
2021-12-02 19:16:41 +01:00
parent d94d4c2045
commit c021b93b5c
9 changed files with 164 additions and 52 deletions

View File

@@ -242,10 +242,7 @@ def get_subscription_feed(db, user, max_results = 40, page = 1)
if user.preferences.notifications_only && !notifications.empty?
# Only show notifications
args = arg_array(notifications)
notifications = db.query_all("SELECT * FROM channel_videos WHERE id IN (#{args}) ORDER BY published DESC", args: notifications, as: ChannelVideo)
notifications = Invidious::Database::ChannelVideos.select(notifications)
videos = [] of ChannelVideo
notifications.sort_by!(&.published).reverse!