X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fdb_views%2Fsrc%2Fcomment_report_view.rs;h=98ff555b74f11f22abb8961efa08411010b7c191;hb=c8063f3267cf2b3622f1fdc69128c6b55feefbbc;hp=a92b3806333af1f4c7560df109e916d172af1257;hpb=9a5a13c734a1792511e1bfef7b9ac4121e0e7371;p=lemmy.git diff --git a/crates/db_views/src/comment_report_view.rs b/crates/db_views/src/comment_report_view.rs index a92b3806..98ff555b 100644 --- a/crates/db_views/src/comment_report_view.rs +++ b/crates/db_views/src/comment_report_view.rs @@ -28,7 +28,7 @@ use lemmy_db_schema::{ source::{ comment::Comment, comment_report::CommentReport, - community::{Community, CommunityPersonBan}, + community::Community, person::Person, post::Post, }, @@ -71,7 +71,7 @@ fn queries<'a>() -> Queries< person::all_columns, aliases::person1.fields(person::all_columns), comment_aggregates::all_columns, - community_person_ban::all_columns.nullable(), + community_person_ban::id.nullable().is_not_null(), comment_like::score.nullable(), aliases::person2.fields(person::all_columns).nullable(), ); @@ -113,7 +113,7 @@ fn queries<'a>() -> Queries< query = query.filter(post::community_id.eq(community_id)); } - if options.unresolved_only.unwrap_or(false) { + if options.unresolved_only { query = query.filter(comment_report::resolved.eq(false)); } @@ -206,7 +206,7 @@ pub struct CommentReportQuery { pub community_id: Option, pub page: Option, pub limit: Option, - pub unresolved_only: Option, + pub unresolved_only: bool, } impl CommentReportQuery { @@ -228,7 +228,7 @@ impl JoinView for CommentReportView { Person, Person, CommentAggregates, - Option, + bool, Option, Option, ); @@ -242,7 +242,7 @@ impl JoinView for CommentReportView { creator: a.4, comment_creator: a.5, counts: a.6, - creator_banned_from_community: a.7.is_some(), + creator_banned_from_community: a.7, my_vote: a.8, resolver: a.9, } @@ -569,7 +569,7 @@ mod tests { // Do a batch read of timmys reports // It should only show saras, which is unresolved let reports_after_resolve = CommentReportQuery { - unresolved_only: (Some(true)), + unresolved_only: (true), ..Default::default() } .list(pool, &inserted_timmy)