Fixing private instance check. Fixes #2064 (#2065)

This commit is contained in:
Dessalines 2022-01-27 11:25:22 -05:00 committed by GitHub
parent 1c5c02e1bf
commit d83a53e905
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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(())