fix: display ENS on contact search results

Fixes #3045
This commit is contained in:
Richard Ramos 2021-08-10 14:01:37 -04:00 committed by Iuri Matias
parent a530f65ada
commit eee22f1cc8
2 changed files with 5 additions and 1 deletions

View File

@ -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

View File

@ -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)
}