chore (backend-rs): move same process outside of a loop
This commit is contained in:
parent
cb2f74ad39
commit
98d14512c1
1 changed files with 13 additions and 9 deletions
|
@ -57,14 +57,15 @@ pub(super) async fn check_hit_antenna(
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
} else if antenna.src == AntennaSrc::Instances {
|
} else if antenna.src == AntennaSrc::Instances {
|
||||||
let is_from_one_of_specified_servers = antenna.instances.iter().any(|host| {
|
let note_author_host = note_author
|
||||||
host.to_ascii_lowercase()
|
.host
|
||||||
== note_author
|
.clone()
|
||||||
.host
|
.unwrap_or_else(|| CONFIG.host.clone())
|
||||||
.clone()
|
.to_ascii_lowercase();
|
||||||
.unwrap_or_else(|| CONFIG.host.clone())
|
let is_from_one_of_specified_servers = antenna
|
||||||
.to_ascii_lowercase()
|
.instances
|
||||||
});
|
.iter()
|
||||||
|
.any(|host| host.to_ascii_lowercase() == note_author_host);
|
||||||
|
|
||||||
if !is_from_one_of_specified_servers {
|
if !is_from_one_of_specified_servers {
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
|
@ -116,7 +117,10 @@ pub(super) async fn check_hit_antenna(
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if [NoteVisibility::Home, NoteVisibility::Followers].contains(¬e.visibility) {
|
if matches!(
|
||||||
|
note.visibility,
|
||||||
|
NoteVisibility::Home | NoteVisibility::Followers
|
||||||
|
) {
|
||||||
let following_user_ids: Vec<String> =
|
let following_user_ids: Vec<String> =
|
||||||
if let Some(ids) = cache::get_one(cache::Category::Follow, &antenna.user_id).await? {
|
if let Some(ids) = cache::get_one(cache::Category::Follow, &antenna.user_id).await? {
|
||||||
ids
|
ids
|
||||||
|
|
Loading…
Reference in a new issue