From 7ad24ef23144ec3183cc7520cec82a06b0513d21 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 12 Jan 2022 12:38:02 -0600 Subject: [PATCH] Fix #4953: Add is_deleted attribute to forum posts. * Add data-is-deleted, data-updater-id, data-topic-id, and data-topic-is-deleted data attributes to forum posts. * Change data-forum-post-id to data-id. * Dim deleted forum posts like comments. --- app/components/forum_post_component.rb | 2 +- .../forum_post_component/forum_post_component.html.erb | 8 ++------ .../forum_post_component/forum_post_component.scss | 8 ++++++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/components/forum_post_component.rb b/app/components/forum_post_component.rb index ccf1a7577..87c4f3b71 100644 --- a/app/components/forum_post_component.rb +++ b/app/components/forum_post_component.rb @@ -3,7 +3,7 @@ class ForumPostComponent < ApplicationComponent attr_reader :forum_post, :original_forum_post_id, :dtext_data, :moderation_reports, :current_user - delegate :link_to_user, :time_ago_in_words_tagged, :format_text, :policy, to: :helpers + delegate :link_to_user, :time_ago_in_words_tagged, :format_text, :policy, :data_attributes_for, to: :helpers with_collection_parameter :forum_post diff --git a/app/components/forum_post_component/forum_post_component.html.erb b/app/components/forum_post_component/forum_post_component.html.erb index be5607d47..fe9ed547a 100644 --- a/app/components/forum_post_component/forum_post_component.html.erb +++ b/app/components/forum_post_component/forum_post_component.html.erb @@ -1,8 +1,4 @@ -
- +<%= tag.article class: "forum-post message", id: "forum_post_#{forum_post.id}", data: { "is-reported": has_moderation_reports?, **data_attributes_for(forum_post, "", forum_post.html_data_attributes) } do %>
<%= link_to_user forum_post.creator %> @@ -63,4 +59,4 @@ <% end %> <% end %>
-
+<% end %> diff --git a/app/components/forum_post_component/forum_post_component.scss b/app/components/forum_post_component/forum_post_component.scss index f6b0624d9..fb4963ec4 100644 --- a/app/components/forum_post_component/forum_post_component.scss +++ b/app/components/forum_post_component/forum_post_component.scss @@ -3,6 +3,14 @@ article.forum-post { background-color: var(--moderation-report-background-color); } + &[data-is-deleted="true"] { + opacity: 0.3; + + &:hover { + opacity: 1; + } + } + a.voted { font-weight: bold; }