mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-16 06:44:20 +01:00
profiles: introduce DisplayNames
This is exactly the same as the DisplayName enum in Damus iOS. Due to the various inconsistencies in `name` and `display_name` between clients, we have to generalize DisplayName into two variants: one name or two names. If we have two names, we treat it in the standard way of display_name is the real name, and `name` is the username. If only one is set, then it is considered both the username and "real name". Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -129,19 +129,17 @@ fn render_note_contents(
|
||||
let name: String = if let Some(name) =
|
||||
profile.as_ref().and_then(crate::profile::get_profile_name)
|
||||
{
|
||||
format!("@{}", name)
|
||||
format!("@{}", name.username())
|
||||
} else {
|
||||
"@nostrich".to_string()
|
||||
"??".to_string()
|
||||
};
|
||||
|
||||
let resp = ui.colored_label(colors::PURPLE, &name);
|
||||
|
||||
if let Some(rec) = profile.as_ref() {
|
||||
resp.on_hover_ui_at_pointer(|ui| {
|
||||
egui::Frame::default().show(ui, |ui| {
|
||||
ui.set_max_width(300.0);
|
||||
ui.add(ui::ProfilePreview::new(rec));
|
||||
});
|
||||
ui.set_max_width(300.0);
|
||||
ui.add(ui::ProfilePreview::new(rec));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user