mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 16:31:18 +00:00
Render display_name instead of name (if set in metadata)
This commit is contained in:
parent
a21e48d597
commit
6265e47886
@ -46,6 +46,21 @@ impl DbPerson {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn display_name(&self) -> Option<&str> {
|
||||
if let Some(md) = &self.metadata {
|
||||
if md.other.contains_key("display_name") {
|
||||
if let Some(serde_json::Value::String(s)) = md.other.get("display_name") {
|
||||
if !s.is_empty() {
|
||||
return Some(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
md.name.as_deref()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> Option<&str> {
|
||||
if let Some(md) = &self.metadata {
|
||||
md.name.as_deref()
|
||||
|
@ -461,7 +461,7 @@ impl GossipUi {
|
||||
|
||||
pub fn render_person_name_line(app: &mut GossipUi, ui: &mut Ui, person: &DbPerson) {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
let name = if let Some(name) = person.name() {
|
||||
let name = if let Some(name) = person.display_name() {
|
||||
name.to_owned()
|
||||
} else {
|
||||
GossipUi::pubkey_short(&person.pubkey)
|
||||
|
Loading…
Reference in New Issue
Block a user