From 0e9ea4df9d2a1cc2a07ac9270458e6686cd67243 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 2 Nov 2024 13:19:29 -0400 Subject: [PATCH] Fixing local user check in apub code. --- crates/apub/src/objects/private_message.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/apub/src/objects/private_message.rs b/crates/apub/src/objects/private_message.rs index 573210c71..365f7c263 100644 --- a/crates/apub/src/objects/private_message.rs +++ b/crates/apub/src/objects/private_message.rs @@ -136,9 +136,14 @@ impl Object for ApubPrivateMessage { let recipient = note.to[0].dereference(context).await?; PersonBlock::read(&mut context.pool(), recipient.id, creator.id).await?; - let recipient_local_user = - LocalUserView::read_person(&mut context.pool(), recipient.id).await?; - check_private_messages_enabled(&recipient_local_user)?; + // If its a local user, check that they can receive private messages + if recipient.local { + if let Ok(recipient_local_user) = + LocalUserView::read_person(&mut context.pool(), recipient.id).await + { + check_private_messages_enabled(&recipient_local_user)?; + } + } let local_site = LocalSite::read(&mut context.pool()).await.ok(); let slur_regex = &local_site_opt_to_slur_regex(&local_site); let url_blocklist = get_url_blocklist(context).await?;