diff --git a/app/assets/stylesheets/debates.scss b/app/assets/stylesheets/debates.scss index 641e7ccff..5017837bc 100644 --- a/app/assets/stylesheets/debates.scss +++ b/app/assets/stylesheets/debates.scss @@ -574,6 +574,8 @@ padding: rem-calc(6) rem-calc(12); } + + &.is-admin { background: $comment-admin; padding: rem-calc(6) rem-calc(12); @@ -585,6 +587,12 @@ } } + .is-deleted { + background: $deleted; + margin-left: rem-calc(42); + padding: rem-calc(6) rem-calc(12); + } + .comment-children { border-left: 1px dashed $border; margin-left: rem-calc(42); diff --git a/app/assets/stylesheets/participacion.scss b/app/assets/stylesheets/participacion.scss index b195899d3..45a8e0bbe 100644 --- a/app/assets/stylesheets/participacion.scss +++ b/app/assets/stylesheets/participacion.scss @@ -822,6 +822,10 @@ img.initialjs-avatar { background: $association; } +.is-deleted { + background: $deleted; +} + .level-1 { background: $level-1; } diff --git a/app/assets/stylesheets/variables.scss b/app/assets/stylesheets/variables.scss index 6240702d2..1954de5bd 100644 --- a/app/assets/stylesheets/variables.scss +++ b/app/assets/stylesheets/variables.scss @@ -76,6 +76,7 @@ $level-5: #F08A24; $author: #008CCF; $association: #C0392B; +$deleted: #E7E7E7; $comment-author: rgba(45,144,248,.15); $comment-level-5: rgba(255,241,204,1); diff --git a/app/models/comment.rb b/app/models/comment.rb index fa5f72164..c23c5c993 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -61,10 +61,6 @@ class Comment < ActiveRecord::Base cached_votes_down end - def not_visible? - hidden? || user.hidden? - end - def ignored_flag? ignored_flag_at.present? end diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 5ffff4a85..e21b148bc 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,16 +1,18 @@
- <% if comment.not_visible? %> - <%= t("debates.comment.deleted") %> + <% if comment.hidden? || comment.user.hidden? %> + <% if comment.children_count > 0 %> +
+

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

+
+ <% end %> <% else %> - <% if comment.as_administrator? %> <%= image_tag("admin_avatar.png", size: 32, class: "admin-avatar left") %> <% elsif comment.as_moderator? %> <%= image_tag("moderator_avatar.png", size: 32, class: "moderator-avatar left") %> <% else %> - <% if comment.user.organization? %> <%= image_tag("collective_avatar.png", size: 32, class: "avatar left") %> <% else %> @@ -19,7 +21,6 @@ <% if comment.user.hidden? %> <% end %> - <% end %>
@@ -91,11 +92,10 @@ <% end %>
- <% end %> -
- <%= render comment.children.for_render.reorder('id DESC, lft') %> -
+
+ <%= render comment.children.for_render.reorder('id DESC, lft') %> +
diff --git a/spec/features/moderation/comments_spec.rb b/spec/features/moderation/comments_spec.rb index 6c2689f0e..4fdef5c10 100644 --- a/spec/features/moderation/comments_spec.rb +++ b/spec/features/moderation/comments_spec.rb @@ -4,7 +4,7 @@ feature 'Moderate Comments' do feature 'Hiding Comments' do - scenario 'Hide', :js do + scenario 'Hide without children hides the comment completely', :js do citizen = create(:user) moderator = create(:moderator) @@ -23,7 +23,7 @@ feature 'Moderate Comments' do visit debate_path(debate) expect(page).to have_css('.comment', count: 1) - expect(page).to have_content('This comment has been deleted') + expect(page).to_not have_content('This comment has been deleted') expect(page).to_not have_content('SPAM') end