X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fdb_views%2Fsrc%2Fcomment_view.rs;h=4a7f96b6acece8cfe782dd869bc007d695654bf2;hb=7f9b55e7935f6093895734b1a45ec128d2cb2a33;hp=6dcda899bea19f550b1c6f77cd9bdcb205062c75;hpb=762b85b27e812856f65933a182188e7102617aae;p=lemmy.git diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index 6dcda899..4a7f96b6 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -448,10 +448,25 @@ impl<'a> CommentQueryBuilder<'a> { }; if let Some(listing_type) = self.listing_type { - query = match listing_type { - ListingType::Subscribed => query.filter(community_follower::person_id.is_not_null()), // TODO could be this: and(community_follower::person_id.eq(person_id_join)), - ListingType::Local => query.filter(community::local.eq(true)), - _ => query, + match listing_type { + ListingType::Subscribed => { + query = query.filter(community_follower::person_id.is_not_null()) + } // TODO could be this: and(community_follower::person_id.eq(person_id_join)), + ListingType::Local => { + query = query.filter(community::local.eq(true)).filter( + community::hidden + .eq(false) + .or(community_follower::person_id.eq(person_id_join)), + ) + } + ListingType::All => { + query = query.filter( + community::hidden + .eq(false) + .or(community_follower::person_id.eq(person_id_join)), + ) + } + ListingType::Community => {} }; } @@ -693,6 +708,7 @@ mod tests { description: None, updated: None, banner: None, + hidden: false, published: inserted_community.published, }, counts: CommentAggregates {