Don't show both realname and username if they are the same

Changelog-Changed: Don't show both realname and username if they are the same
This commit is contained in:
William Casarin
2023-03-14 16:26:52 -06:00
parent af8ce3d32d
commit 04bce34297
12 changed files with 207 additions and 117 deletions

View File

@@ -140,17 +140,8 @@ struct Profile: Codable {
try container.encode(value)
}
static func displayName(profile: Profile?, pubkey: String) -> String {
if pubkey == "anon" {
return "Anonymous"
}
if let name = profile?.name, !name.isEmpty {
return name
} else {
let pk = bech32_nopre_pubkey(pubkey) ?? pubkey
return abbrev_pubkey(pk)
}
static func displayName(profile: Profile?, pubkey: String) -> DisplayName {
return parse_display_name(profile: profile, pubkey: pubkey)
}
}