Request Reddit comm when yt disabled during nojs=1

This commit is contained in:
syeopite 2023-09-17 12:41:37 -07:00
parent 41f82f189b
commit 9311724e69
No known key found for this signature in database
GPG Key ID: A73C186DA3955A1A
3 changed files with 20 additions and 11 deletions

View File

@ -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",

View File

@ -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

View File

@ -314,17 +314,24 @@ we're going to need to do it here in order to allow for translations.
</noscript>
<% end %>
<% else %>
<div id="comments-turned-off-on-video-message" class="h-box v-box">
<p><b><%=HTML.escape(translate(locale, "comments_youtube_disabled_text"))%></b></p>
<% if !nojs %>
<div id="comments-turned-off-on-video-message" class="h-box v-box">
<p><b><%=HTML.escape(translate(locale, "comments_youtube_disabled_text"))%></b></p>
<p><b><button data-comments="reddit" id="try-reddit-comments-link" class="simulated_a">
<%=HTML.escape(translate(locale, "comments_youtube_disabled_try_reddit"))%>
</button></b></p>
</div>
<% end %>
<p>
<b>
<button data-comments="reddit" id="try-reddit-comments-link" class="simulated_a">
<%=HTML.escape(translate(locale, "comments_youtube_disabled_try_reddit"))%>
</button>
</b>
</p>
</div>
<noscript>
<% if nojs %>
<%= comment_html %>
<% else %>
<a href="/watch?<%= env.params.query %>&nojs=1">
<%= translate(locale, "comments_youtube_disabled_try_reddit_no_js") %>
</a>
<% end %>
</noscript>
<% end %>
<% end %>
</div>