From c94d133a28f76ea2c8e7cf72e124388919682193 Mon Sep 17 00:00:00 2001 From: syeopite Date: Sun, 17 Sep 2023 12:41:37 -0700 Subject: [PATCH] Request Reddit comm when yt disabled during nojs=1 --- locales/en-US.json | 1 + src/invidious/routes/watch.cr | 3 ++- src/invidious/views/watch.ecr | 27 +++++++++++++++++---------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/locales/en-US.json b/locales/en-US.json index 5eb13c77f..8032cf987 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -225,6 +225,7 @@ "comments_youtube_disabled_text": "Youtube comments are disabled on this video", "comments_youtube_disabled_try_reddit": "Try reddit comments?", "comments_invidious_disabled_text": "Comments are hidden as per user preferences", + "comments_youtube_disabled_try_reddit_no_js": "Hi! Looks like you have JavaScript turned off. Although the uploader has disabled YouTube comments you can still click here to try and view Reddit comments, keep in mind they may take a bit longer to load.", "Incorrect password": "Incorrect password", "Wrong answer": "Wrong answer", "Erroneous CAPTCHA": "Erroneous CAPTCHA", diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index 7a68a145f..3c66f1bc0 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -79,7 +79,8 @@ module Invidious::Routes::Watch if nojs if preferences - source = preferences.comments[0] + source = video.comments? ? preferences.comments[0] : "reddit" + if source.empty? source = preferences.comments[1] end diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 65b71dc50..ec8c5a988 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -314,17 +314,24 @@ we're going to need to do it here in order to allow for translations. <% end %> <% else %> -
-

<%= HTML.escape(I18n.translate(locale, "comments_youtube_disabled_text")) %>

+ <% if !nojs %> +
+

<%= HTML.escape(I18n.translate(locale, "comments_youtube_disabled_text")) %>

+

+
+ <% end %> -

- - - -

-
+ <% end %> <% end %>