Show comments with hidden authors

In the past, whenever we hid users, we also hid their comments.
However, we've now implemented an action to hide users without hiding
their comments. In this case, we still want to show the comment, but we
weren't doing so.
This commit is contained in:
Javi Martín
2021-12-22 15:50:32 +01:00
parent 3b2b09be2b
commit 7caee9a93c
2 changed files with 11 additions and 1 deletions

View File

@@ -2,7 +2,7 @@
<% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author] do %> <% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author] do %>
<div id="<%= dom_id(comment) %>" class="comment small-12"> <div id="<%= dom_id(comment) %>" class="comment small-12">
<div class="comment-body"> <div class="comment-body">
<% if comment.hidden? || comment.user.hidden? %> <% if comment.hidden? %>
<% if comment.children.size > 0 %> <% if comment.children.size > 0 %>
<div class="callout secondary"> <div class="callout secondary">
<p><%= t("comments.comment.deleted") %></p> <p><%= t("comments.comment.deleted") %></p>

View File

@@ -371,6 +371,16 @@ describe "Commenting debates" do
end end
end end
scenario "Show comment when the author is hidden" do
create(:comment, body: "This is pointless", commentable: debate, author: create(:user, :hidden))
visit debate_path(debate)
within ".comment", text: "This is pointless" do
expect(page).to have_content "User deleted"
end
end
scenario "Errors on reply" do scenario "Errors on reply" do
comment = create(:comment, commentable: debate, user: user) comment = create(:comment, commentable: debate, user: user)