lemmy/migrations/2022-09-07-114618_pm-reports/up.sql
Nutomic 004efd5d94
Implement reports for private messages (#2433)
* Implement reports for private messages

* finish private message report view + test

* implement api for pm reports

* merge list report api calls into one, move report count to site

* fix compile error

* Revert "merge list report api calls into one, move report count to site"

This reverts commit 3bf3b06a705c6bcf2bf20d07e2819b81298790f3.

* add websocket messages for pm report created/resolved

* remove private_message_report_view

* add joinable private_message_report -> person_alias_1

* Address review comments
2022-09-19 22:58:42 +00:00

13 lines
737 B
SQL

create table private_message_report (
id serial primary key,
creator_id int references person on update cascade on delete cascade not null, -- user reporting comment
private_message_id int references private_message on update cascade on delete cascade not null, -- comment being reported
original_pm_text text not null,
reason text not null,
resolved bool not null default false,
resolver_id int references person on update cascade on delete cascade, -- user resolving report
published timestamp not null default now(),
updated timestamp null,
unique(private_message_id, creator_id) -- users should only be able to report a pm once
);