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.
This commit is contained in:
evazion
2022-01-12 12:38:02 -06:00
parent c1a1741d20
commit 7ad24ef231
3 changed files with 11 additions and 7 deletions

View File

@@ -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

View File

@@ -1,8 +1,4 @@
<article class="forum-post message" id="forum_post_<%= forum_post.id %>"
data-forum-post-id="<%= forum_post.id %>"
data-is-reported="<%= has_moderation_reports? %>"
data-creator-id="<%= forum_post.creator_id %>">
<%= 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 %>
<div class="author">
<div class="author-name">
<%= link_to_user forum_post.creator %>
@@ -63,4 +59,4 @@
<% end %>
<% end %>
</div>
</article>
<% end %>

View File

@@ -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;
}