mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-18 17:14:21 +01:00
mention: show username instead of display_name
Fixes: #833 Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -19,6 +19,16 @@ impl<'a> NostrName<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn username_or_displayname(&self) -> &'a str {
|
||||||
|
if let Some(name) = self.username {
|
||||||
|
name
|
||||||
|
} else if let Some(name) = self.display_name {
|
||||||
|
name
|
||||||
|
} else {
|
||||||
|
self.nip05.unwrap_or("??")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn unknown() -> Self {
|
pub fn unknown() -> Self {
|
||||||
Self {
|
Self {
|
||||||
username: None,
|
username: None,
|
||||||
|
|||||||
@@ -77,7 +77,10 @@ fn mention_ui(
|
|||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
let profile = ndb.get_profile_by_pubkey(txn, pk).ok();
|
let profile = ndb.get_profile_by_pubkey(txn, pk).ok();
|
||||||
|
|
||||||
let name: String = format!("@{}", get_display_name(profile.as_ref()).name());
|
let name: String = format!(
|
||||||
|
"@{}",
|
||||||
|
get_display_name(profile.as_ref()).username_or_displayname()
|
||||||
|
);
|
||||||
|
|
||||||
let resp = ui.add(
|
let resp = ui.add(
|
||||||
egui::Label::new(egui::RichText::new(name).color(link_color).size(size))
|
egui::Label::new(egui::RichText::new(name).color(link_color).size(size))
|
||||||
|
|||||||
Reference in New Issue
Block a user