X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fdb_views_actor%2Fsrc%2Fcomment_reply_view.rs;h=97d5b31ebc8d5a3e94b34bc941e9372a55ef7062;hb=c8063f3267cf2b3622f1fdc69128c6b55feefbbc;hp=869345200ae169a49385ab867869f9e2b59001a9;hpb=9a5a13c734a1792511e1bfef7b9ac4121e0e7371;p=lemmy.git diff --git a/crates/db_views_actor/src/comment_reply_view.rs b/crates/db_views_actor/src/comment_reply_view.rs index 86934520..97d5b31e 100644 --- a/crates/db_views_actor/src/comment_reply_view.rs +++ b/crates/db_views_actor/src/comment_reply_view.rs @@ -27,16 +27,16 @@ use lemmy_db_schema::{ post, }, source::{ - comment::{Comment, CommentSaved}, + comment::Comment, comment_reply::CommentReply, - community::{Community, CommunityFollower, CommunityPersonBan}, + community::{Community, CommunityFollower}, person::Person, - person_block::PersonBlock, post::Post, }, traits::JoinView, utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn}, CommentSortType, + SubscribedType, }; type CommentReplyViewTuple = ( @@ -47,10 +47,10 @@ type CommentReplyViewTuple = ( Community, Person, CommentAggregates, - Option, - Option, - Option, - Option, + bool, + SubscribedType, + bool, + bool, Option, ); @@ -112,10 +112,10 @@ fn queries<'a>() -> Queries< community::all_columns, aliases::person1.fields(person::all_columns), comment_aggregates::all_columns, - community_person_ban::all_columns.nullable(), - community_follower::all_columns.nullable(), - comment_saved::all_columns.nullable(), - person_block::all_columns.nullable(), + community_person_ban::id.nullable().is_not_null(), + CommunityFollower::select_subscribed_type(), + comment_saved::id.nullable().is_not_null(), + person_block::id.nullable().is_not_null(), comment_like::score.nullable(), )) }; @@ -138,11 +138,11 @@ fn queries<'a>() -> Queries< query = query.filter(comment_reply::recipient_id.eq(recipient_id)); } - if options.unread_only.unwrap_or(false) { + if options.unread_only { query = query.filter(comment_reply::read.eq(false)); } - if !options.show_bot_accounts.unwrap_or(true) { + if !options.show_bot_accounts { query = query.filter(person::bot_account.eq(false)); }; @@ -203,8 +203,8 @@ pub struct CommentReplyQuery { pub my_person_id: Option, pub recipient_id: Option, pub sort: Option, - pub unread_only: Option, - pub show_bot_accounts: Option, + pub unread_only: bool, + pub show_bot_accounts: bool, pub page: Option, pub limit: Option, } @@ -226,10 +226,10 @@ impl JoinView for CommentReplyView { community: a.4, recipient: a.5, counts: a.6, - creator_banned_from_community: a.7.is_some(), - subscribed: CommunityFollower::to_subscribed_type(&a.8), - saved: a.9.is_some(), - creator_blocked: a.10.is_some(), + creator_banned_from_community: a.7, + subscribed: a.8, + saved: a.9, + creator_blocked: a.10, my_vote: a.11, } }