diff --git a/src/components/SocialActionRow.tsx b/src/components/SocialActionRow.tsx index 765c2984..c7f1d41c 100644 --- a/src/components/SocialActionRow.tsx +++ b/src/components/SocialActionRow.tsx @@ -15,8 +15,16 @@ export function SocialActionRow(props: { const getContacts = cache(async () => { try { - const contacts = await state.mutiny_wallet?.get_contacts_sorted(); - return contacts || []; + const contacts: TagItem[] = + (await state.mutiny_wallet?.get_contacts_sorted()) || []; + + // contact must have a npub, ln_address, or lnurl + return contacts.filter( + (contact) => + contact.npub !== undefined || + contact.ln_address !== undefined || + contact.lnurl !== undefined + ); } catch (e) { console.error(e); return []; @@ -69,7 +77,7 @@ export function SocialActionRow(props: { name={contact.name} image_url={contact.primal_image_url} onClick={() => { - if (profileDeleted()) { + if (profileDeleted() || !contact.npub) { sendToContact(contact); } else { navigate(`/chat/${contact.id}`); diff --git a/src/routes/Search.tsx b/src/routes/Search.tsx index 58544d69..7810cfdf 100644 --- a/src/routes/Search.tsx +++ b/src/routes/Search.tsx @@ -246,7 +246,31 @@ function ActualSearch(props: { initialValue?: string }) { throw new Error("no contact returned"); } - sendToContact(tagItem); + // if the new contact has an npub, send to chat + // otherwise, send to send page + if (tagItem.npub) { + sendToContact(tagItem); + } else if (tagItem.ln_address) { + actions.handleIncomingString( + tagItem.ln_address, + () => {}, + () => { + navigate("/send"); + } + ); + } else if (tagItem.lnurl) { + actions.handleIncomingString( + tagItem.lnurl, + () => {}, + () => { + navigate("/send"); + } + ); + } else { + console.error( + "No npub, ln_address, or lnurl found, this should never happen" + ); + } } catch (e) { console.error(e); }