diff --git a/app/models/podcast_episode.rb b/app/models/podcast_episode.rb
index 788064a7b..7e8460cd8 100644
--- a/app/models/podcast_episode.rb
+++ b/app/models/podcast_episode.rb
@@ -73,6 +73,10 @@ class PodcastEpisode < ApplicationRecord
ActionView::Base.full_sanitizer.sanitize(processed_html)
end
+ def score
+ 1 # When it is expected that a "commentable" has a score, this is the fallback.
+ end
+
def zero_method
0
end
diff --git a/app/views/comments/index.html.erb b/app/views/comments/index.html.erb
index 42e674629..24046ae39 100644
--- a/app/views/comments/index.html.erb
+++ b/app/views/comments/index.html.erb
@@ -25,6 +25,10 @@
+ <% if @root_comment.score < 0 || @commentable.score < 0 %>
+
+
+ <% end %>
<% else %>
" />
" />
diff --git a/spec/requests/comments_spec.rb b/spec/requests/comments_spec.rb
index db6c2aefa..b44b88bc0 100644
--- a/spec/requests/comments_spec.rb
+++ b/spec/requests/comments_spec.rb
@@ -49,6 +49,23 @@ RSpec.describe "Comments", type: :request do
get comment.path
expect(response.body).to include(comment.processed_html)
end
+
+ it "displays noindex if comment has score of less than 0" do
+ comment.update_column(:score, -5)
+ get comment.path
+ expect(response.body).to include('')
+ end
+
+ it "displays does not display noindex if comment has 0 or more score" do
+ get comment.path
+ expect(response.body).not_to include('')
+ end
+
+ it "displays noindex if comment has score of less than 0" do
+ comment.commentable.update_column(:score, -5)
+ get comment.path
+ expect(response.body).to include('')
+ end
end
context "when the comment is a child comment" do