From db40325c44ea6819822292cb699623a35bc13e6e Mon Sep 17 00:00:00 2001
From: jojobyte <184880+jojobyte@users.noreply.github.com>
Date: Wed, 10 Apr 2024 23:28:15 -0600
Subject: [PATCH 01/20] fix: :bug: minor bug fixes for contacts
---
src/components/contacts-list.js | 2 +-
src/helpers/utils.js | 3 ++-
src/rigs/edit-contact.js | 12 ++++++++++--
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/components/contacts-list.js b/src/components/contacts-list.js
index 307f4eb..16a112d 100644
--- a/src/components/contacts-list.js
+++ b/src/components/contacts-list.js
@@ -110,7 +110,7 @@ const initialState = {
let name = c.info?.name
if (
- !name &&
+ !name?.trim() &&
!user &&
!out?.xkeyId &&
out?.address
diff --git a/src/helpers/utils.js b/src/helpers/utils.js
index 79c70df..ec8dd08 100644
--- a/src/helpers/utils.js
+++ b/src/helpers/utils.js
@@ -489,7 +489,8 @@ export async function restate(
}
export function filterPairedContacts(contact) {
- return !!contact.alias || !!contact.info?.name?.trim()
+ let outLen = Object.keys(contact.outgoing || {}).length
+ return outLen > 0 // && !!contact.alias
}
export function filterUnpairedContacts(contact) {
diff --git a/src/rigs/edit-contact.js b/src/rigs/edit-contact.js
index 3cacd2d..f80b933 100644
--- a/src/rigs/edit-contact.js
+++ b/src/rigs/edit-contact.js
@@ -147,13 +147,21 @@ export let editContactRig = (async function (globals) {
`,
+ getAlias: state => {
+ let alias = state.contact?.alias || state.contact?.info?.preferred_username
+ if (!alias) {
+ return ''
+ }
+
+ return html`@${alias}`
+ },
content: async state => html`