diff --git a/crates/db_views_actor/src/community_view.rs b/crates/db_views_actor/src/community_view.rs index 828738c27..c1cb6eee1 100644 --- a/crates/db_views_actor/src/community_view.rs +++ b/crates/db_views_actor/src/community_view.rs @@ -17,6 +17,7 @@ use lemmy_db_schema::{ community_aggregates, community_block, community_follower, + community_person_ban, instance_block, local_user, }, @@ -58,6 +59,13 @@ fn queries<'a>() -> Queries< .and(community_block::person_id.eq(person_id_join)), ), ) + .left_join( + community_person_ban::table.on( + community::id + .eq(community_person_ban::community_id) + .and(community_person_ban::person_id.eq(person_id_join)), + ), + ) }; let selection = ( @@ -65,6 +73,7 @@ fn queries<'a>() -> Queries< CommunityFollower::select_subscribed_type(), community_block::community_id.nullable().is_not_null(), community_aggregates::all_columns, + community_person_ban::person_id.nullable().is_not_null(), ); let not_removed_or_deleted = community::removed diff --git a/crates/db_views_actor/src/structs.rs b/crates/db_views_actor/src/structs.rs index 46817be78..f25662f7b 100644 --- a/crates/db_views_actor/src/structs.rs +++ b/crates/db_views_actor/src/structs.rs @@ -80,6 +80,7 @@ pub struct CommunityView { pub subscribed: SubscribedType, pub blocked: bool, pub counts: CommunityAggregates, + pub banned_from_community: bool, } #[derive(Debug, Serialize, Deserialize, Clone)]