From 5ad2fc64b4d34cb2cb5e0fcf0fd3777b35058a75 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Thu, 6 Jan 2022 22:01:09 +0100 Subject: [PATCH] DB: Move a forgotten 'UPDATE channels' statement --- src/invidious/database/channels.cr | 10 ++++++++++ src/invidious/routes/feeds.cr | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/invidious/database/channels.cr b/src/invidious/database/channels.cr index 134cf59d2..b45527333 100644 --- a/src/invidious/database/channels.cr +++ b/src/invidious/database/channels.cr @@ -42,6 +42,16 @@ module Invidious::Database::Channels PG_DB.exec(request, Time.utc, author, id) end + def update_subscription_time(id : String) + request = <<-SQL + UPDATE channels + SET subscribed = $1 + WHERE id = $2 + SQL + + PG_DB.exec(request, Time.utc, id) + end + def update_mark_deleted(id : String) request = <<-SQL UPDATE channels diff --git a/src/invidious/routes/feeds.cr b/src/invidious/routes/feeds.cr index fd8c25ce9..c323cdf78 100644 --- a/src/invidious/routes/feeds.cr +++ b/src/invidious/routes/feeds.cr @@ -362,7 +362,7 @@ module Invidious::Routes::Feeds end if ucid = HTTP::Params.parse(URI.parse(topic).query.not_nil!)["channel_id"]? - PG_DB.exec("UPDATE channels SET subscribed = $1 WHERE id = $2", Time.utc, ucid) + Invidious::Database::Channels.update_subscription_time(ucid) elsif plid = HTTP::Params.parse(URI.parse(topic).query.not_nil!)["playlist_id"]? Invidious::Database::Playlists.update_subscription_time(plid) else