Browse Source

Switching to iterator.

linked_instances_2
Dessalines 5 months ago
parent
commit
4f6a53b7cf
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      src/api/mod.rs

+ 5
- 4
src/api/mod.rs View File

@ -107,11 +107,12 @@ pub(in crate::api) async fn linked_instances(pool: &DbPool) -> Result<Vec<String
})
.await??;
for actor_id in &distinct_communities {
instances.push(Url::parse(actor_id)?.host_str().unwrap_or("").to_string());
}
instances = distinct_communities
.iter()
.map(|actor_id| Ok(Url::parse(actor_id)?.host_str().unwrap_or("").to_string()))
.collect::<Result<Vec<String>, LemmyError>>()?;
instances.extend(Settings::get().get_allowed_instances().into_iter());
instances.append(&mut Settings::get().get_allowed_instances());
instances.retain(|a| {
!Settings::get().get_blocked_instances().contains(a)
&& !a.eq("")


Loading…
Cancel
Save