fix(@desktop/settings-contacts): it is not possible to add new contacts after the first one is added

Fixes #4658
This commit is contained in:
Sale Djenic 2022-02-03 11:39:46 +01:00 committed by saledjenic
parent c85734f08d
commit 0b3cafdbc4
3 changed files with 12 additions and 11 deletions

View File

@ -21,9 +21,6 @@ const lookupContactTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
# TODO refactor those calls to use the new backend and also do it in a signle call # TODO refactor those calls to use the new backend and also do it in a signle call
pubkey = ens_utils.pubkey(arg.value) pubkey = ens_utils.pubkey(arg.value)
address = ens_utils.address(arg.value) address = ens_utils.address(arg.value)
else:
pubkey = ""
address = ""
let output = %*{ let output = %*{
"id": pubkey, "id": pubkey,

View File

@ -213,7 +213,7 @@ Item {
Connections { Connections {
target: root.contactsStore.mainModuleInst target: root.contactsStore.mainModuleInst
onResolvedENS: function (resolvedPubKey) { onResolvedENS: {
if (resolvedPubKey === "") { if (resolvedPubKey === "") {
searchResults.pubKey = "" searchResults.pubKey = ""
searchResults.showProfileNotFoundMessage = true searchResults.showProfileNotFoundMessage = true

View File

@ -19,6 +19,8 @@ import StatusQ.Components 0.1
Item { Item {
id: root id: root
height: 64 height: 64
width: parent.width
property bool hasExistingContacts: false property bool hasExistingContacts: false
property bool showProfileNotFoundMessage: false property bool showProfileNotFoundMessage: false
property bool loading: false property bool loading: false
@ -28,12 +30,7 @@ Item {
property string address: "" property string address: ""
property bool resultClickable: true property bool resultClickable: true
property bool addContactEnabled: true property bool addContactEnabled: true
property bool isAddedContact: false
property bool isAddedContact: root.isContactAdded()
function isContactAdded() {
return root.pubKey != "" ? Utils.getContactDetailsAsJson(root.pubKey).isContact : false
}
signal resultClicked(string pubKey, bool isAddedContact, string username) signal resultClicked(string pubKey, bool isAddedContact, string username)
signal addToContactsButtonClicked(string pubKey) signal addToContactsButtonClicked(string pubKey)
@ -44,9 +41,16 @@ Item {
username = "" username = ""
userAlias = "" userAlias = ""
pubKey = "" pubKey = ""
isAddedContact = false
} }
width: parent.width function isContactAdded() {
return root.pubKey != "" ? Utils.getContactDetailsAsJson(root.pubKey).isContact : false
}
onPubKeyChanged: {
root.isAddedContact = root.isContactAdded()
}
StyledText { StyledText {
id: nonContactsLabel id: nonContactsLabel