bug: getDisplayName

This commit is contained in:
Kieran 2023-04-19 10:29:44 +01:00
parent 11101d4cbf
commit 7abb49066e
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
1 changed files with 2 additions and 2 deletions

View File

@ -78,9 +78,9 @@ export default function ProfileImage({
export function getDisplayName(user: MetadataCache | undefined, pubkey: HexKey) {
let name = hexToBech32(NostrPrefix.PublicKey, pubkey).substring(0, 12);
if (user?.display_name !== undefined && user.display_name.length > 0) {
if (typeof user?.display_name === "string" && user.display_name.length > 0) {
name = user.display_name;
} else if (user?.name !== undefined && user.name.length > 0) {
} else if (typeof user?.name === "string" && user.name.length > 0) {
name = user.name;
}
return name;