From 9311724e69a3152d550843ae874cfc045cbf0249 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 a7f7f592e..0a26db78c 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -216,6 +216,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 3d935f0ad..326be1e76 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -80,7 +80,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 fdff8b8e1..3e20061d3 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(translate(locale, "comments_youtube_disabled_text"))%>

+ <% if !nojs %> +
+

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

+

+
+ <% end %> -

- - - -

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