From 7caee9a93c0b07b92b971b50fa57b05a8cab66ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 22 Dec 2021 15:50:32 +0100 Subject: [PATCH] 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. --- app/views/comments/_comment.html.erb | 2 +- spec/system/comments/debates_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index ae0cb1276..0ea042746 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -2,7 +2,7 @@ <% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author] do %>
- <% if comment.hidden? || comment.user.hidden? %> + <% if comment.hidden? %> <% if comment.children.size > 0 %>

<%= t("comments.comment.deleted") %>

diff --git a/spec/system/comments/debates_spec.rb b/spec/system/comments/debates_spec.rb index 706cd8142..57cca11d7 100644 --- a/spec/system/comments/debates_spec.rb +++ b/spec/system/comments/debates_spec.rb @@ -371,6 +371,16 @@ describe "Commenting debates" do 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 comment = create(:comment, commentable: debate, user: user)