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:
BrokenEagle
2020-01-18 21:10:50 +00:00
parent 4cef0e45c2
commit a3e889bdf5
13 changed files with 76 additions and 7 deletions

View File

@@ -3,6 +3,13 @@
<%= render "comments/partials/index/header", :post => post %>
<% end %>
<% if CurrentUser.is_moderator? && post.moderation_reports.any? %>
<div class="row moderation-comments-notice">
<span class="info" id="moderation-comments-notice-for-<%= post.id %>">
This post has comments reported for moderation! (<%= post.moderation_reports.count %> <%= (post.moderation_reports.count == 1 ? "report" : "reports") %>)
</span>
</div>
<% end %>
<% if post.comments.hidden(CurrentUser.user).any? || (page == :comments && post.comments.size > 6) %>
<div class="row hidden-comments-notice">
<span class="info" id="threshold-comments-notice-for-<%= post.id %>">
@@ -13,7 +20,7 @@
<div class="list-of-comments list-of-messages">
<% if comments.present? %>
<%= render partial: "comments/partials/show/comment", collection: comments, locals: { context: :index_by_post, dtext_data: DText.preprocess(comments.map(&:body)) } %>
<%= render partial: "comments/partials/show/comment", collection: comments, locals: { context: :index_by_post, dtext_data: DText.preprocess(comments.map(&:body)), moderation_reports: (CurrentUser.is_moderator? ? post.moderation_reports : []) } %>
<% elsif post.last_commented_at.present? %>
<p>There are no visible comments.</p>
<% else %>