Convert instance name to lowercase

This commit is contained in:
Felix Ableitner 2022-04-04 13:14:34 +02:00
parent 4e95487842
commit 9546936ddf
2 changed files with 12 additions and 4 deletions

View file

@ -120,10 +120,18 @@ async fn fetch_instance_details(domain: &str) -> Result<InstanceDetails, Error>
} }
} }
let linked_instances = site_info let require_application = site_info
.site_view
.site
.require_application
.unwrap_or(false);
let linked_instances: Vec<String> = site_info
.federated_instances .federated_instances
.map(|f| f.linked) .map(|f| f.linked)
.unwrap_or_default(); .unwrap_or_default()
.iter()
.map(|l| l.to_lowercase())
.collect();
Ok(InstanceDetails { Ok(InstanceDetails {
domain: domain.to_owned(), domain: domain.to_owned(),
name: site_info.site_view.site.name, name: site_info.site_view.site.name,
@ -136,7 +144,7 @@ async fn fetch_instance_details(domain: &str) -> Result<InstanceDetails, Error>
users_active_month: node_info.usage.users.active_month, users_active_month: node_info.usage.users.active_month,
open_registrations: node_info.open_registrations, open_registrations: node_info.open_registrations,
linked_instances_count: linked_instances.len() as i32, linked_instances_count: linked_instances.len() as i32,
require_application: site_info.site_view.site.require_application.unwrap_or(false), require_application,
linked_instances, linked_instances,
}) })
} }

View file

@ -24,5 +24,5 @@ pub struct Site {
pub name: String, pub name: String,
pub icon: Option<String>, pub icon: Option<String>,
pub description: Option<String>, pub description: Option<String>,
pub require_application: Option<bool> pub require_application: Option<bool>,
} }