From: Dessalines Date: Thu, 27 Jan 2022 16:25:22 +0000 (-0500) Subject: Fixing private instance check. Fixes #2064 (#2065) X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%24%7B%60data:application/static/%7B%60https:/README.ru.md?a=commitdiff_plain;h=d83a53e90575ca9cc4bd38df3dbd17dadd8ff83b;p=lemmy.git Fixing private instance check. Fixes #2064 (#2065) --- diff --git a/crates/api_common/src/lib.rs b/crates/api_common/src/lib.rs index 6dcdb58b..a83f0071 100644 --- a/crates/api_common/src/lib.rs +++ b/crates/api_common/src/lib.rs @@ -280,9 +280,13 @@ pub async fn check_private_instance( pool: &DbPool, ) -> Result<(), LemmyError> { if local_user_view.is_none() { - let site = blocking(pool, Site::read_simple).await??; - if site.private_instance { - return Err(LemmyError::from_message("instance_is_private")); + let site = blocking(pool, Site::read_simple).await?; + + // The site might not be set up yet + if let Ok(site) = site { + if site.private_instance { + return Err(LemmyError::from_message("instance_is_private")); + } } } Ok(())