mod reports: enable reporting for members, add dmail reporting.

* Add ability to report dmails.
* Enable reports for comments, forum posts, and dmails.
* Allow Members to send reports.
* Don't allow users to report the same thing twice.
This commit is contained in:
evazion
2020-01-27 12:55:59 -06:00
parent 812918556f
commit af044c45db
19 changed files with 56 additions and 49 deletions

View File

@@ -3,10 +3,10 @@
<%= render "comments/partials/index/header", :post => post %>
<% end %>
<% if post.viewable_moderation_reports.present? %>
<% if post.moderation_reports.visible.recent.present? %>
<div class="row moderation-comments-notice">
<span class="info" id="moderation-comments-notice-for-<%= post.id %>">
This post has comments reported for moderation! (<%= pluralize(post.viewable_moderation_reports.length, "report") %>)
This post has comments reported for moderation! (<%= pluralize(post.moderation_reports.visible.recent.length, "report") %>)
</span>
</div>
<% end %>
@@ -20,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)), moderation_reports: post.viewable_moderation_reports } %>
<%= render partial: "comments/partials/show/comment", collection: comments, locals: { context: :index_by_post, dtext_data: DText.preprocess(comments.map(&:body)), moderation_reports: post.moderation_reports.visible.recent } %>
<% elsif post.last_commented_at.present? %>
<p>There are no visible comments.</p>
<% else %>

View File

@@ -57,7 +57,7 @@
<%= link_to "Unvote", comment_comment_votes_path(comment_id: comment.id), method: :delete, remote: true %>
</li>
<% if comment.reportable_by?(CurrentUser.user) %>
<li><%= link_to "Report comment", new_moderation_report_path(moderation_report: { model_type: "Comment", model_id: comment.id }), remote: true %></li>
<li><%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "Comment", model_id: comment.id }), remote: true %></li>
<% end %>
</menu>
<% if comment.editable_by?(CurrentUser.user) %>