Request Reddit comm when yt disabled during nojs=1

This commit is contained in:
syeopite
2023-09-17 12:41:37 -07:00
parent e0807139eb
commit f1785170f0
3 changed files with 20 additions and 11 deletions

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>