fix(chat): fix starting 1-1 chat because of ContactList signal bug

Fixes #4421
This commit is contained in:
Jonathan Rainville 2022-01-12 12:56:41 -05:00 committed by Sale Djenic
parent 191efa5829
commit 47b139ee1c
4 changed files with 13 additions and 13 deletions

View File

@ -21,8 +21,8 @@ ModalPopup {
signal joinPrivateChat(string publicKey, string ensName) signal joinPrivateChat(string publicKey, string ensName)
signal profileClicked() signal profileClicked()
function doJoin(pk, ensName) { function doJoin(pubKey, username) {
popup.joinPrivateChat(pk, Utils.isChatKey(pk) ? "" : ensName); popup.joinPrivateChat(pubKey, Utils.isChatKey(pubKey) ? "" : username);
popup.close(); popup.close();
} }
@ -31,8 +31,7 @@ ModalPopup {
contactFieldAndList.pubKey = "" contactFieldAndList.pubKey = ""
contactFieldAndList.ensUsername = "" contactFieldAndList.ensUsername = ""
contactFieldAndList.chatKey.forceActiveFocus(Qt.MouseFocusReason) contactFieldAndList.chatKey.forceActiveFocus(Qt.MouseFocusReason)
// Not Refactored Yet contactFieldAndList.existingContacts.visible = contactsStore.myContactsModel.count > 0
// contactFieldAndList.existingContacts.visible = popup.store.allContacts.hasAddedContacts()
contactFieldAndList.noContactsRect.visible = !contactFieldAndList.existingContacts.visible contactFieldAndList.noContactsRect.visible = !contactFieldAndList.existingContacts.visible
} }
@ -45,8 +44,8 @@ ModalPopup {
contactsStore: popup.contactsStore contactsStore: popup.contactsStore
onUserClicked: function (isContact, pubKey, ensName) { onUserClicked: function (pubKey, isAddedContact, username) {
popup.doJoin(pubKey, ensName); popup.doJoin(pubKey, username);
} }
} }

View File

@ -55,8 +55,9 @@ Item {
contactsStore: root.contactsStore contactsStore: root.contactsStore
onUserClicked: function (isContact, pubKey, ensName, address) { onUserClicked: function (pubKey, isContact) {
chatKey.text = address console.warning("This is not refactored yet. We need to figure out where to get the address from")
//chatKey.text = address
} }
searchResultsWidth: parentWidth searchResultsWidth: parentWidth
chatKey.customHeight: 56 chatKey.customHeight: 56

View File

@ -32,7 +32,7 @@ Item {
property bool showCheckbox: false property bool showCheckbox: false
property bool showContactList: true property bool showContactList: true
property bool showSearch: true property bool showSearch: true
signal userClicked(string pubKey, bool isAddedContact) signal userClicked(string pubKey, bool isAddedContact, string name)
property var pubKeys: ([]) property var pubKeys: ([])
property bool hideCommunityMembers: false property bool hideCommunityMembers: false
property bool addContactEnabled: true property bool addContactEnabled: true
@ -197,7 +197,7 @@ Item {
} }
root.pubKeys = pubKeysCopy root.pubKeys = pubKeysCopy
userClicked(contact.pubKey, contact.isContact) userClicked(contact.pubKey, contact.isContact, contact.name)
} }
expanded: !searchResults.loading && pubKey === "" && !searchResults.showProfileNotFoundMessage expanded: !searchResults.loading && pubKey === "" && !searchResults.showProfileNotFoundMessage
} }
@ -215,7 +215,7 @@ Item {
if (!validate()) { if (!validate()) {
return return
} }
userClicked(pubKey, isAddedContact) userClicked(pubKey, isAddedContact, username)
} }
onAddToContactsButtonClicked: { onAddToContactsButtonClicked: {
root.contactsStore.addContact(pubKey) root.contactsStore.addContact(pubKey)

View File

@ -35,7 +35,7 @@ Item {
return root.pubKey != "" ? Utils.getContactDetailsAsJson(root.pubKey).isContact : false return root.pubKey != "" ? Utils.getContactDetailsAsJson(root.pubKey).isContact : false
} }
signal resultClicked(string pubKey, bool isAddedContact) signal resultClicked(string pubKey, bool isAddedContact, string username)
signal addToContactsButtonClicked(string pubKey) signal addToContactsButtonClicked(string pubKey)
function reset() { function reset() {
@ -117,7 +117,7 @@ Item {
onExited: foundContact.hovered = false onExited: foundContact.hovered = false
onClicked: { onClicked: {
if (root.resultClickable) { if (root.resultClickable) {
root.resultClicked(root.pubKey, root.isAddedContact) root.resultClicked(root.pubKey, root.isAddedContact, root.username)
} }
} }
} }