Fix #4669: Track moderation report status.

* Add ability to mark moderation reports as 'handled' or 'rejected'.
* Automatically mark reports as handled when the comment or forum post
  is deleted.
* Send a dmail to the reporter when their report is handled.
* Don't show the report notice on comments or forum posts when all
  reports against it have been handled or rejected.
* Add a fix script to mark all existing reports for deleted comments,
  forum posts, or dmails as handled.
This commit is contained in:
evazion
2022-01-20 17:41:05 -06:00
parent 98aee048f2
commit c8d27c2719
20 changed files with 160 additions and 16 deletions

View File

@@ -7,6 +7,7 @@
<%= f.input :reason_matches, label: "Reason", input_html: { value: params[:search][:reason_matches] } %>
<%= f.input :model_id, label: "ID", input_html: { value: params[:search][:model_id] } %>
<%= f.input :model_type, label: "Type", collection: ModerationReport.model_types, include_blank: true, selected: params[:search][:model_type] %>
<%= f.input :status, label: "Status", collection: ModerationReport.statuses.keys, include_blank: true, selected: params[:search][:status] %>
<%= f.submit "Search" %>
<% end %>
@@ -26,6 +27,10 @@
</span>
<% end %>
<% t.column "Status" do |report| %>
<%= link_to report.status.capitalize, moderation_reports_path(search: { status: report.status }) %>
<% end %>
<% t.column "Reported user" do |report| %>
<%= link_to_user report.reported_user %>
<% end %>
@@ -35,6 +40,18 @@
<%= link_to "»", moderation_reports_path(search: { creator_name: report.creator.name }) %>
<div><%= time_ago_in_words_tagged(report.created_at) %></div>
<% end %>
<% t.column column: "control" do |report| %>
<%= render PopupMenuComponent.new do |menu| %>
<% menu.item do %>
<%= link_to "Mark as handled", moderation_report_path(report.id), method: :put, remote: true, "data-params": "moderation_report[status]=handled" %>
<% end %>
<% menu.item do %>
<%= link_to "Reject", moderation_report_path(report.id), method: :put, remote: true, "data-params": "moderation_report[status]=rejected" %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= numbered_paginator(@moderation_reports) %>

View File

@@ -0,0 +1 @@
location.reload();