From a9ada7c4db80054c8569c52ac4c6bb59ef1b88e0 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 22 Jul 2024 18:26:14 -0400 Subject: [PATCH] Addressing PR comments. --- crates/db_views_actor/src/community_moderator_view.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/db_views_actor/src/community_moderator_view.rs b/crates/db_views_actor/src/community_moderator_view.rs index f287bf595..f2a59fd9f 100644 --- a/crates/db_views_actor/src/community_moderator_view.rs +++ b/crates/db_views_actor/src/community_moderator_view.rs @@ -7,7 +7,6 @@ use lemmy_db_schema::{ schema::{community, community_moderator, person}, source::local_user::LocalUser, utils::{get_conn, DbPool}, - CommunityVisibility, }; impl CommunityModeratorView { @@ -59,10 +58,10 @@ impl CommunityModeratorView { .await } - pub async fn for_person<'a>( + pub async fn for_person( pool: &mut DbPool<'_>, person_id: PersonId, - local_user: Option<&'a LocalUser>, + local_user: Option<&LocalUser>, ) -> Result, Error> { let conn = &mut get_conn(pool).await?; let mut query = community_moderator::table @@ -72,9 +71,7 @@ impl CommunityModeratorView { .select((community::all_columns, person::all_columns)) .into_boxed(); - if local_user.is_none() { - query = query.filter(community::visibility.eq(CommunityVisibility::Public)); - } + query = local_user.visible_communities_only(query); // only show deleted communities to creator if Some(person_id) != local_user.person_id() {