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

@@ -0,0 +1,6 @@
class AddStatusToModerationReports < ActiveRecord::Migration[7.0]
def change
add_column :moderation_reports, :status, :integer, null: false, default: 0
add_index :moderation_reports, :status
end
end

View File

@@ -1202,7 +1202,8 @@ CREATE TABLE public.moderation_reports (
model_type character varying NOT NULL,
model_id bigint NOT NULL,
creator_id integer NOT NULL,
reason text NOT NULL
reason text NOT NULL,
status integer DEFAULT 0 NOT NULL
);
@@ -3847,6 +3848,13 @@ CREATE INDEX index_moderation_reports_on_creator_id ON public.moderation_reports
CREATE INDEX index_moderation_reports_on_model_type_and_model_id ON public.moderation_reports USING btree (model_type, model_id);
--
-- Name: index_moderation_reports_on_status; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_moderation_reports_on_status ON public.moderation_reports USING btree (status);
--
-- Name: index_news_updates_on_created_at; Type: INDEX; Schema: public; Owner: -
--
@@ -5688,6 +5696,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20220110171021'),
('20220110171022'),
('20220110171023'),
('20220110171024');
('20220110171024'),
('20220120233850');