From eee22f1cc874295ff26c0eec1ce38cdb706a0a90 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Tue, 10 Aug 2021 14:01:37 -0400 Subject: [PATCH] fix: display ENS on contact search results Fixes #3045 --- ui/app/AppLayouts/Profile/Sections/ContactsContainer.qml | 2 +- ui/imports/Utils.qml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/app/AppLayouts/Profile/Sections/ContactsContainer.qml b/ui/app/AppLayouts/Profile/Sections/ContactsContainer.qml index 4d852bcfd2..80985eac79 100644 --- a/ui/app/AppLayouts/Profile/Sections/ContactsContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/ContactsContainer.qml @@ -183,7 +183,7 @@ Item { contactsContainer.isPending = false return } - searchResults.username = utilsModel.generateAlias(resolvedPubKey) + searchResults.username = Utils.isChatKey(addContactSearchInput.text) ? utilsModel.generateAlias(resolvedPubKey) : Utils.addStatusEns(addContactSearchInput.text.trim()) searchResults.userAlias = Utils.compactAddress(resolvedPubKey, 4) searchResults.pubKey = resolvedPubKey searchResults.showProfileNotFoundMessage = false diff --git a/ui/imports/Utils.qml b/ui/imports/Utils.qml index 7b3ee5a813..7a549b2501 100644 --- a/ui/imports/Utils.qml +++ b/ui/imports/Utils.qml @@ -190,6 +190,10 @@ QtObject { return userName.endsWith(".stateofus.eth") ? userName.substr(0, userName.length - 14) : userName } + function addStatusEns(userName){ + return userName.endsWith(".eth") ? userName : userName + ".stateofus.eth" + } + function isValidAddress(inputValue) { return inputValue !== "0x" && /^0x[a-fA-F0-9]{40}$/.test(inputValue) }