Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't error when a channel doesn't have any community posts #4413

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion locales/en-US.json
Expand Up @@ -496,5 +496,6 @@
"toggle_theme": "Toggle Theme",
"carousel_slide": "Slide {{current}} of {{total}}",
"carousel_skip": "Skip the Carousel",
"carousel_go_to": "Go to slide `x`"
"carousel_go_to": "Go to slide `x`",
"channel_has_no_posts": "This channel hasn't posted yet"
}
8 changes: 8 additions & 0 deletions src/invidious/channels/community.cr
Expand Up @@ -57,6 +57,14 @@ def extract_channel_community(items, *, ucid, locale, format, thin_mode, is_sing
.try &.as_s || ""
if error_message == "This channel does not exist."
raise NotFoundException.new(error_message)
elsif error_message == "This channel hasn't posted yet"
response = JSON.build do |json|
json.object do
json.field "authorId", ucid
json.field "comments", json.array { }
end
end
return response
else
raise InfoException.new(error_message)
end
Expand Down
4 changes: 4 additions & 0 deletions src/invidious/views/community.ecr
Expand Up @@ -25,6 +25,10 @@
<div class="h-box">
<p><%= error_message %></p>
</div>
<% elsif items.not_nil!["comments"].as_a.empty? %>
<div class="h-box">
<%= translate(locale, "channel_has_no_posts") %>
</div>
<% else %>
<div class="h-box pure-g comments" id="comments">
<%= IV::Frontend::Comments.template_youtube(items.not_nil!, locale, thin_mode) %>
Expand Down