Addressing PR comments.

This commit is contained in:
Dessalines 2024-07-22 18:26:14 -04:00
parent ea2b1ca008
commit a9ada7c4db

View file

@ -7,7 +7,6 @@ use lemmy_db_schema::{
schema::{community, community_moderator, person}, schema::{community, community_moderator, person},
source::local_user::LocalUser, source::local_user::LocalUser,
utils::{get_conn, DbPool}, utils::{get_conn, DbPool},
CommunityVisibility,
}; };
impl CommunityModeratorView { impl CommunityModeratorView {
@ -59,10 +58,10 @@ impl CommunityModeratorView {
.await .await
} }
pub async fn for_person<'a>( pub async fn for_person(
pool: &mut DbPool<'_>, pool: &mut DbPool<'_>,
person_id: PersonId, person_id: PersonId,
local_user: Option<&'a LocalUser>, local_user: Option<&LocalUser>,
) -> Result<Vec<Self>, Error> { ) -> Result<Vec<Self>, Error> {
let conn = &mut get_conn(pool).await?; let conn = &mut get_conn(pool).await?;
let mut query = community_moderator::table let mut query = community_moderator::table
@ -72,9 +71,7 @@ impl CommunityModeratorView {
.select((community::all_columns, person::all_columns)) .select((community::all_columns, person::all_columns))
.into_boxed(); .into_boxed();
if local_user.is_none() { query = local_user.visible_communities_only(query);
query = query.filter(community::visibility.eq(CommunityVisibility::Public));
}
// only show deleted communities to creator // only show deleted communities to creator
if Some(person_id) != local_user.person_id() { if Some(person_id) != local_user.person_id() {