Fix watch history order

This commit is contained in:
Brahim Hadriche 2023-02-19 19:01:28 -05:00
parent b287ff2126
commit 8445d3ae12
2 changed files with 3 additions and 4 deletions

View file

@ -50,6 +50,7 @@ module Invidious::Database::Users
end
def mark_watched(user : User, vid : String)
mark_unwatched(user, vid)
request = <<-SQL
UPDATE users
SET watched = array_append(watched, $1)

View file

@ -76,7 +76,7 @@ module Invidious::Routes::Watch
end
env.params.query.delete_all("iv_load_policy")
if watched && preferences.watch_history && !watched.includes? id
if watched && preferences.watch_history
Invidious::Database::Users.mark_watched(user.as(User), id)
end
@ -259,9 +259,7 @@ module Invidious::Routes::Watch
case action
when "action_mark_watched"
if !user.watched.includes? id
Invidious::Database::Users.mark_watched(user, id)
end
when "action_mark_unwatched"
Invidious::Database::Users.mark_unwatched(user, id)
else