Skip to content

Commit

Permalink
Ignore empty names from contact store (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
hrdl-github authored Dec 12, 2024
1 parent e579ee8 commit 9885df1
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,25 @@ impl App {
async fn resolve_name(&self, user_id: Uuid) -> Option<String> {
if let Some(name) = self.signal_manager.profile_name(user_id).await {
debug!(name, "resolved name as profile name");
Some(name)
} else if let Some(contact) = self.signal_manager.contact(user_id).await {
debug!(name = contact.name, "resolved name from contacts");
Some(contact.name)
} else if let Some(name) = self
return Some(name);
}
if let Some(contact) = self.signal_manager.contact(user_id).await {
if !contact.name.trim().is_empty() {
debug!(name = contact.name, "resolved name from contacts");
return Some(contact.name);
} else {
debug!(%user_id, "resolved empty name from contacts, skipping");
}
}
if let Some(name) = self
.storage
.name(user_id)
.filter(|name| !name.trim().is_empty())
{
debug!(%name, "resolved name from storage");
Some(name.into_owned())
} else {
None
return Some(name.into_owned());
}
None
}

// Resolves name of a user by their id
Expand Down

0 comments on commit 9885df1

Please sign in to comment.