Fixing private instance check. Fixes #2064

fix_private_instance_check
Dessalines 2022-01-26 15:31:03 -05:00
parent f53902ecff
commit 80aaf81352
3 changed files with 9 additions and 9 deletions

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

View File

@ -161,7 +161,7 @@ where
#[allow(clippy::to_string_in_display)]
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
// Use to_string here because Url.display is not useful for us
write!(f, "{}", self.0.to_string())
write!(f, "{}", self.0)
}
}

View File

@ -97,11 +97,7 @@ async fn get_feed_data(
let mut channel_builder = ChannelBuilder::default();
channel_builder
.namespaces(RSS_NAMESPACE.to_owned())
.title(&format!(
"{} - {}",
site_view.site.name,
listing_type.to_string()
))
.title(&format!("{} - {}", site_view.site.name, listing_type))
.link(context.settings().get_protocol_and_hostname())
.items(items);