Added highlighting and notices for moderators
- Posts and topics have an added moderation_reports function -- This is so all moderation reports can be loaded in a single query - Those moderation reports are passed into the render functions separately -- This is so the individual comments/posts don't have to be queried
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
<% if forum_post.visible?(CurrentUser.user, ActiveModel::Type::Boolean.new.cast(params.dig(:search, :is_deleted))) %>
|
||||
<article class="forum-post message" id="forum_post_<%= forum_post.id %>" data-forum-post-id="<%= forum_post.id %>" data-creator="<%= forum_post.creator.name %>">
|
||||
<article class="forum-post message" id="forum_post_<%= forum_post.id %>"
|
||||
data-forum-post-id="<%= forum_post.id %>"
|
||||
<% if CurrentUser.is_moderator? %>
|
||||
data-is-reported="<%= moderation_reports.pluck(:model_id).include?(forum_post.id) %>"
|
||||
<% end %>
|
||||
data-creator="<%= forum_post.creator.name %>">
|
||||
<div class="author">
|
||||
<h4>
|
||||
<%= link_to_user forum_post.creator %>
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
<%- # forum_post %>
|
||||
<%- # original_forum_post_id %>
|
||||
<%- # dtext_data %>
|
||||
<%- # moderation_reports %>
|
||||
|
||||
<div class="list-of-forum-posts list-of-messages">
|
||||
<% if CurrentUser.is_moderator? && moderation_reports.any? %>
|
||||
<div class="row moderation-forums-notice">
|
||||
<span class="info" id="moderation-forums-notice-for-topic">
|
||||
This topic has forum posts reported for moderation! (<%= moderation_reports.count %> <%= (moderation_reports.count == 1 ? "report" : "reports") %>)
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% forum_posts.each do |forum_post| %>
|
||||
<%= render "forum_posts/forum_post", forum_post: forum_post, original_forum_post_id: original_forum_post_id, dtext_data: dtext_data %>
|
||||
<%= render "forum_posts/forum_post", forum_post: forum_post, original_forum_post_id: original_forum_post_id, dtext_data: dtext_data, moderation_reports: moderation_reports %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user