Skip to content

Commit

Permalink
Remove deduplication from add_or_lookup_contacts_by_address_list
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Jan 9, 2025
1 parent b8c2aa3 commit 28e198b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/receive_imf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2961,15 +2961,12 @@ pub(crate) async fn get_prefetch_parent_message(
}

/// Looks up contact IDs from the database given the list of recipients.
///
/// Returns vector of IDs guaranteed to be unique.
async fn add_or_lookup_contacts_by_address_list(
context: &Context,
address_list: &[SingleInfo],
origin: Origin,
) -> Result<Vec<ContactId>> {
let mut contact_ids = Vec::new();
let mut contact_ids_set = HashSet::new();
for info in address_list {
let addr = &info.addr;
if !may_be_valid_addr(addr) {
Expand All @@ -2980,10 +2977,7 @@ async fn add_or_lookup_contacts_by_address_list(
let (contact_id, _) =
Contact::add_or_lookup(context, display_name.unwrap_or_default(), &addr, origin)
.await?;
if !contact_ids_set.contains(&contact_id) {
contact_ids.push(contact_id);
contact_ids_set.insert(contact_id);
}
contact_ids.push(contact_id);
} else {
warn!(context, "Contact with address {:?} cannot exist.", addr);
}
Expand Down

0 comments on commit 28e198b

Please sign in to comment.