]> Untitled Git - lemmy.git/commitdiff
add current context for reports
authoreiknat <eiknat@protonmail.com>
Sun, 25 Oct 2020 03:24:50 +0000 (23:24 -0400)
committereiknat <eiknat@dev.chapo.chat>
Wed, 11 Nov 2020 20:11:52 +0000 (15:11 -0500)
lemmy_db/src/comment_report.rs
lemmy_db/src/post_report.rs
migrations/2020-10-13-212240_create_report_tables/up.sql

index b9692aea16a46eb16f6bb72264c14dd7e888e863..a2b4e1d30415371eb60f03605c501e5edefb06e1 100644 (file)
@@ -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,
index 1741edf843fc268db2ca8f3d3142d8470e7bccae..234b0e4dbfd2b9305f3216fd2ac49607503f8a10 100644 (file)
@@ -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,
index 98553625da53069abbbc035587e1105295aa5445..840d3d99aedd9c434567e77bda524900f628b3fc 100644 (file)
@@ -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,