From 23e5b6ba72c3c39df97c4fd21980997b9a30e303 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 23 Mar 2021 02:25:47 +0000 Subject: [PATCH] Remove extra 'next page' button at then end of a playlist --- src/invidious/routes/playlists.cr | 7 +++++++ src/invidious/views/playlist.ecr | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/invidious/routes/playlists.cr b/src/invidious/routes/playlists.cr index 19e6541f..73c14155 100644 --- a/src/invidious/routes/playlists.cr +++ b/src/invidious/routes/playlists.cr @@ -433,6 +433,13 @@ class Invidious::Routes::Playlists < Invidious::Routes::BaseRoute return error_template(500, ex) end + page_count = (playlist.video_count / 100).to_i + page_count = 1 if page_count == 0 + + if page > page_count + return env.redirect "/playlist?list=#{plid}&page=#{page_count}" + end + if playlist.privacy == PlaylistPrivacy::Private && playlist.author != user.try &.email return error_template(403, "This playlist is private.") end diff --git a/src/invidious/views/playlist.ecr b/src/invidious/views/playlist.ecr index bb721c3a..91156028 100644 --- a/src/invidious/views/playlist.ecr +++ b/src/invidious/views/playlist.ecr @@ -103,7 +103,7 @@
- <% if videos.size == 100 %> + <% if page_count != 1 && page < page_count %> <%= translate(locale, "Next page") %>