mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-10 06:54:12 +00:00
add current context for reports
This commit is contained in:
parent
2cd2a4df45
commit
070efe72af
3 changed files with 14 additions and 2 deletions
|
@ -15,6 +15,7 @@ table! {
|
|||
published -> Timestamp,
|
||||
updated -> Nullable<Timestamp>,
|
||||
post_id -> Int4,
|
||||
current_comment_text -> Text,
|
||||
community_id -> Int4,
|
||||
creator_name -> Varchar,
|
||||
comment_creator_id -> Int4,
|
||||
|
@ -91,6 +92,7 @@ pub struct CommentReportView {
|
|||
pub published: chrono::NaiveDateTime,
|
||||
pub updated: Option<chrono::NaiveDateTime>,
|
||||
pub post_id: i32,
|
||||
pub current_comment_text: String,
|
||||
pub community_id: i32,
|
||||
pub creator_name: String,
|
||||
pub comment_creator_id: i32,
|
||||
|
|
|
@ -16,6 +16,9 @@ table! {
|
|||
resolver_id -> Nullable<Int4>,
|
||||
published -> Timestamp,
|
||||
updated -> Nullable<Timestamp>,
|
||||
current_post_name -> Varchar,
|
||||
current_post_url -> Nullable<Text>,
|
||||
current_post_body -> Nullable<Text>,
|
||||
community_id -> Int4,
|
||||
creator_name -> Varchar,
|
||||
post_creator_id -> Int4,
|
||||
|
@ -97,6 +100,9 @@ pub struct PostReportView {
|
|||
pub resolver_id: Option<i32>,
|
||||
pub published: chrono::NaiveDateTime,
|
||||
pub updated: Option<chrono::NaiveDateTime>,
|
||||
pub current_post_name: String,
|
||||
pub current_post_url: Option<String>,
|
||||
pub current_post_body: Option<String>,
|
||||
pub community_id: i32,
|
||||
pub creator_name: String,
|
||||
pub post_creator_id: i32,
|
||||
|
|
|
@ -5,7 +5,7 @@ create table comment_report (
|
|||
comment_text text not null,
|
||||
reason text not null,
|
||||
resolved bool not null default false,
|
||||
resolver_id int references user_ on update cascade on delete cascade not null, -- user resolving report
|
||||
resolver_id int references user_ on update cascade on delete cascade, -- user resolving report
|
||||
published timestamp not null default now(),
|
||||
updated timestamp null,
|
||||
unique(comment_id, creator_id) -- users should only be able to report a comment once
|
||||
|
@ -20,7 +20,7 @@ create table post_report (
|
|||
post_body text,
|
||||
reason text not null,
|
||||
resolved bool not null default false,
|
||||
resolver_id int references user_ on update cascade on delete cascade not null, -- user resolving report
|
||||
resolver_id int references user_ on update cascade on delete cascade, -- user resolving report
|
||||
published timestamp not null default now(),
|
||||
updated timestamp null,
|
||||
unique(post_id, creator_id) -- users should only be able to report a post once
|
||||
|
@ -29,6 +29,7 @@ create table post_report (
|
|||
create or replace view comment_report_view as
|
||||
select cr.*,
|
||||
c.post_id,
|
||||
c.content as current_comment_text,
|
||||
p.community_id,
|
||||
f.name as creator_name,
|
||||
u.id as comment_creator_id,
|
||||
|
@ -41,6 +42,9 @@ left join user_ f on f.id = cr.creator_id;
|
|||
|
||||
create or replace view post_report_view as
|
||||
select pr.*,
|
||||
p.name as current_post_name,
|
||||
p.url as current_post_url,
|
||||
p.body as current_post_body,
|
||||
p.community_id,
|
||||
f.name as creator_name,
|
||||
u.id as post_creator_id,
|
||||
|
|
Loading…
Reference in a new issue