From 84ab67372619085c37a645980c2a1781d18eb3c4 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 5 Jun 2024 18:28:28 -0400 Subject: [PATCH] When banning from local communities, make sure they aren't deleted or removed. - This is causing some federation issues. - Context: #4782 --- crates/db_schema/src/impls/person.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/db_schema/src/impls/person.rs b/crates/db_schema/src/impls/person.rs index 0255785d6..c2ede1bb3 100644 --- a/crates/db_schema/src/impls/person.rs +++ b/crates/db_schema/src/impls/person.rs @@ -12,7 +12,14 @@ use crate::{ traits::{ApubActor, Crud, Followable}, utils::{functions::lower, get_conn, naive_now, DbPool}, }; -use diesel::{dsl::insert_into, result::Error, CombineDsl, ExpressionMethods, JoinOnDsl, QueryDsl}; +use diesel::{ + dsl::{insert_into, not}, + result::Error, + CombineDsl, + ExpressionMethods, + JoinOnDsl, + QueryDsl, +}; use diesel_async::RunQueryDsl; #[async_trait] @@ -100,6 +107,8 @@ impl Person { .inner_join(post::table) .inner_join(community::table.on(post::community_id.eq(community::id))) .filter(community::local.eq(true)) + .filter(not(community::deleted)) + .filter(not(community::removed)) .filter(comment::creator_id.eq(for_creator_id)) .select(community::id) .union(