From: eiknat Date: Sun, 25 Oct 2020 03:24:50 +0000 (-0400) Subject: add current context for reports X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/readmes/%22https:/hacktivis.me/%7Bs.link%7D?a=commitdiff_plain;h=070efe72af4ba400d9e4b3d2194af599c2d45e5f;p=lemmy.git add current context for reports --- diff --git a/lemmy_db/src/comment_report.rs b/lemmy_db/src/comment_report.rs index b9692aea..a2b4e1d3 100644 --- a/lemmy_db/src/comment_report.rs +++ b/lemmy_db/src/comment_report.rs @@ -15,6 +15,7 @@ table! { published -> Timestamp, updated -> Nullable, 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, pub post_id: i32, + pub current_comment_text: String, pub community_id: i32, pub creator_name: String, pub comment_creator_id: i32, diff --git a/lemmy_db/src/post_report.rs b/lemmy_db/src/post_report.rs index 1741edf8..234b0e4d 100644 --- a/lemmy_db/src/post_report.rs +++ b/lemmy_db/src/post_report.rs @@ -16,6 +16,9 @@ table! { resolver_id -> Nullable, published -> Timestamp, updated -> Nullable, + current_post_name -> Varchar, + current_post_url -> Nullable, + current_post_body -> Nullable, community_id -> Int4, creator_name -> Varchar, post_creator_id -> Int4, @@ -97,6 +100,9 @@ pub struct PostReportView { pub resolver_id: Option, pub published: chrono::NaiveDateTime, pub updated: Option, + pub current_post_name: String, + pub current_post_url: Option, + pub current_post_body: Option, pub community_id: i32, pub creator_name: String, pub post_creator_id: i32, diff --git a/migrations/2020-10-13-212240_create_report_tables/up.sql b/migrations/2020-10-13-212240_create_report_tables/up.sql index 98553625..840d3d99 100644 --- a/migrations/2020-10-13-212240_create_report_tables/up.sql +++ b/migrations/2020-10-13-212240_create_report_tables/up.sql @@ -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,