mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-23 05:33:07 +05:30
Fix watch history order (#3653)
This commit is contained in:
commit
1eb1bae370
@ -52,7 +52,7 @@ module Invidious::Database::Users
|
||||
def mark_watched(user : User, vid : String)
|
||||
request = <<-SQL
|
||||
UPDATE users
|
||||
SET watched = array_append(watched, $1)
|
||||
SET watched = array_append(array_remove(watched, $1), $1)
|
||||
WHERE email = $2
|
||||
SQL
|
||||
|
||||
|
@ -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
|
||||
|
@ -48,7 +48,7 @@ struct Invidious::User
|
||||
|
||||
if data["watch_history"]?
|
||||
user.watched += data["watch_history"].as_a.map(&.as_s)
|
||||
user.watched.uniq!
|
||||
user.watched.reverse!.uniq!.reverse!
|
||||
Invidious::Database::Users.update_watch_history(user)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user