From 8445d3ae120c52eba531183caa1fa63d5701f322 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Sun, 19 Feb 2023 19:01:28 -0500 Subject: [PATCH] Fix watch history order --- src/invidious/database/users.cr | 1 + src/invidious/routes/watch.cr | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/invidious/database/users.cr b/src/invidious/database/users.cr index 0a4a4fd8..f8422874 100644 --- a/src/invidious/database/users.cr +++ b/src/invidious/database/users.cr @@ -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) diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index 5d3845c3..813cb0f4 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -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 + Invidious::Database::Users.mark_watched(user, id) when "action_mark_unwatched" Invidious::Database::Users.mark_unwatched(user, id) else